Commit 4e935a53 authored by Konstantin Osipov's avatar Konstantin Osipov

Extract reload_acl_and_cache() and flush_tables_with_read_lock()

into an own implementation file.
parent f8372252
...@@ -997,6 +997,7 @@ libmysqld/.deps/sql_cursor.Po ...@@ -997,6 +997,7 @@ libmysqld/.deps/sql_cursor.Po
libmysqld/.deps/sql_db.Po libmysqld/.deps/sql_db.Po
libmysqld/.deps/sql_delete.Po libmysqld/.deps/sql_delete.Po
libmysqld/.deps/sql_truncate.Po libmysqld/.deps/sql_truncate.Po
libmysqld/.deps/sql_reload.Po
libmysqld/.deps/datadict.Po libmysqld/.deps/datadict.Po
libmysqld/.deps/sql_derived.Po libmysqld/.deps/sql_derived.Po
libmysqld/.deps/sql_do.Po libmysqld/.deps/sql_do.Po
...@@ -1175,6 +1176,7 @@ libmysqld/sql_cursor.h ...@@ -1175,6 +1176,7 @@ libmysqld/sql_cursor.h
libmysqld/sql_db.cc libmysqld/sql_db.cc
libmysqld/sql_delete.cc libmysqld/sql_delete.cc
libmysqld/sql_truncate.cc libmysqld/sql_truncate.cc
libmysqld/sql_reload.cc
libmysqld/datadict.cc libmysqld/datadict.cc
libmysqld/sql_derived.cc libmysqld/sql_derived.cc
libmysqld/sql_do.cc libmysqld/sql_do.cc
...@@ -2067,6 +2069,7 @@ sql/.deps/sql_cursor.Po ...@@ -2067,6 +2069,7 @@ sql/.deps/sql_cursor.Po
sql/.deps/sql_db.Po sql/.deps/sql_db.Po
sql/.deps/sql_delete.Po sql/.deps/sql_delete.Po
sql/.deps/sql_truncate.Po sql/.deps/sql_truncate.Po
sql/.deps/sql_reload.Po
sql/.deps/datadict.Po sql/.deps/datadict.Po
sql/.deps/sql_derived.Po sql/.deps/sql_derived.Po
sql/.deps/sql_do.Po sql/.deps/sql_do.Po
......
...@@ -64,7 +64,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc ...@@ -64,7 +64,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/sql_db.cc ../sql/sql_delete.cc ../sql/sql_derived.cc ../sql/sql_db.cc ../sql/sql_delete.cc ../sql/sql_derived.cc
../sql/sql_do.cc ../sql/sql_error.cc ../sql/sql_handler.cc ../sql/sql_do.cc ../sql/sql_error.cc ../sql/sql_handler.cc
../sql/sql_help.cc ../sql/sql_insert.cc ../sql/datadict.cc ../sql/sql_help.cc ../sql/sql_insert.cc ../sql/datadict.cc
../sql/sql_truncate.cc ../sql/sql_truncate.cc ../sql/sql_reload.cc
../sql/sql_lex.cc ../sql/keycaches.cc ../sql/sql_lex.cc ../sql/keycaches.cc
../sql/sql_list.cc ../sql/sql_load.cc ../sql/sql_locale.cc ../sql/sql_list.cc ../sql/sql_load.cc ../sql/sql_locale.cc
../sql/sql_binlog.cc ../sql/sql_manager.cc ../sql/sql_binlog.cc ../sql/sql_manager.cc
......
...@@ -64,6 +64,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ ...@@ -64,6 +64,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
opt_sum.cc procedure.cc records.cc sql_acl.cc \ opt_sum.cc procedure.cc records.cc sql_acl.cc \
sql_load.cc discover.cc sql_locale.cc \ sql_load.cc discover.cc sql_locale.cc \
sql_profile.cc sql_truncate.cc datadict.cc \ sql_profile.cc sql_truncate.cc datadict.cc \
sql_reload.cc \
sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \ sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \
sql_crypt.cc sql_db.cc sql_delete.cc sql_error.cc sql_insert.cc \ sql_crypt.cc sql_db.cc sql_delete.cc sql_error.cc sql_insert.cc \
sql_lex.cc sql_list.cc sql_manager.cc \ sql_lex.cc sql_list.cc sql_manager.cc \
......
...@@ -75,6 +75,7 @@ SET (SQL_SOURCE ...@@ -75,6 +75,7 @@ SET (SQL_SOURCE
sql_profile.cc event_parse_data.cc sql_profile.cc event_parse_data.cc
sql_signal.cc rpl_handler.cc mdl.cc sql_signal.cc rpl_handler.cc mdl.cc
transaction.cc sys_vars.cc sql_truncate.cc datadict.cc transaction.cc sys_vars.cc sql_truncate.cc datadict.cc
sql_reload.cc
${GEN_SOURCES} ${GEN_SOURCES}
${MYSYS_LIBWRAP_SOURCE}) ${MYSYS_LIBWRAP_SOURCE})
......
...@@ -40,6 +40,7 @@ DTRACEFILES = filesort.o \ ...@@ -40,6 +40,7 @@ DTRACEFILES = filesort.o \
sql_cursor.o \ sql_cursor.o \
sql_delete.o \ sql_delete.o \
sql_truncate.o \ sql_truncate.o \
sql_reload.o \
sql_insert.o \ sql_insert.o \
datadict.o \ datadict.o \
sql_parse.o \ sql_parse.o \
...@@ -59,6 +60,7 @@ DTRACEFILES_DEPEND = filesort.o \ ...@@ -59,6 +60,7 @@ DTRACEFILES_DEPEND = filesort.o \
sql_cursor.o \ sql_cursor.o \
sql_delete.o \ sql_delete.o \
sql_truncate.o \ sql_truncate.o \
sql_reload.o \
sql_insert.o \ sql_insert.o \
datadict.o \ datadict.o \
sql_parse.o \ sql_parse.o \
...@@ -126,7 +128,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ ...@@ -126,7 +128,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
contributors.h sql_servers.h sql_signal.h records.h \ contributors.h sql_servers.h sql_signal.h records.h \
sql_prepare.h rpl_handler.h replication.h mdl.h \ sql_prepare.h rpl_handler.h replication.h mdl.h \
sql_plist.h transaction.h sys_vars.h sql_truncate.h \ sql_plist.h transaction.h sys_vars.h sql_truncate.h \
datadict.h sql_reload.h datadict.h
mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
item.cc item_sum.cc item_buff.cc item_func.cc \ item.cc item_sum.cc item_buff.cc item_func.cc \
...@@ -140,7 +142,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ ...@@ -140,7 +142,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
sql_connect.cc scheduler.cc sql_parse.cc \ sql_connect.cc scheduler.cc sql_parse.cc \
keycaches.cc set_var.cc sql_yacc.yy sys_vars.cc \ keycaches.cc set_var.cc sql_yacc.yy sys_vars.cc \
sql_base.cc table.cc sql_select.cc sql_insert.cc \ sql_base.cc table.cc sql_select.cc sql_insert.cc \
datadict.cc sql_profile.cc \ sql_reload.cc datadict.cc sql_profile.cc \
sql_prepare.cc sql_error.cc sql_locale.cc \ sql_prepare.cc sql_error.cc sql_locale.cc \
sql_update.cc sql_delete.cc uniques.cc sql_do.cc \ sql_update.cc sql_delete.cc uniques.cc sql_do.cc \
procedure.cc sql_test.cc sql_truncate.cc \ procedure.cc sql_test.cc sql_truncate.cc \
......
...@@ -9,48 +9,6 @@ struct TABLE_LIST; ...@@ -9,48 +9,6 @@ struct TABLE_LIST;
class THD; class THD;
typedef struct st_mysql_lock MYSQL_LOCK; typedef struct st_mysql_lock MYSQL_LOCK;
/* mysql_lock_tables() and open_table() flags bits */
#define MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK 0x0001
#define MYSQL_OPEN_IGNORE_FLUSH 0x0002
#define MYSQL_OPEN_TEMPORARY_ONLY 0x0004
#define MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY 0x0008
#define MYSQL_LOCK_LOG_TABLE 0x0010
/**
Do not try to acquire a metadata lock on the table: we
already have one.
*/
#define MYSQL_OPEN_HAS_MDL_LOCK 0x0020
/**
If in locked tables mode, ignore the locked tables and get
a new instance of the table.
*/
#define MYSQL_OPEN_GET_NEW_TABLE 0x0040
/** Don't look up the table in the list of temporary tables. */
#define MYSQL_OPEN_SKIP_TEMPORARY 0x0080
/** Fail instead of waiting when conficting metadata lock is discovered. */
#define MYSQL_OPEN_FAIL_ON_MDL_CONFLICT 0x0100
/** Open tables using MDL_SHARED lock instead of one specified in parser. */
#define MYSQL_OPEN_FORCE_SHARED_MDL 0x0200
/**
Open tables using MDL_SHARED_HIGH_PRIO lock instead of one specified
in parser.
*/
#define MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL 0x0400
/**
When opening or locking the table, use the maximum timeout
(LONG_TIMEOUT = 1 year) rather than the user-supplied timeout value.
*/
#define MYSQL_LOCK_IGNORE_TIMEOUT 0x0800
/** Please refer to the internals manual. */
#define MYSQL_OPEN_REOPEN (MYSQL_OPEN_IGNORE_FLUSH |\
MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |\
MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY |\
MYSQL_LOCK_IGNORE_TIMEOUT |\
MYSQL_OPEN_GET_NEW_TABLE |\
MYSQL_OPEN_SKIP_TEMPORARY |\
MYSQL_OPEN_HAS_MDL_LOCK)
MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count, uint flags); MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count, uint flags);
void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock); void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock);
......
...@@ -87,6 +87,7 @@ ...@@ -87,6 +87,7 @@
#include <errmsg.h> #include <errmsg.h>
#include "sp_rcontext.h" #include "sp_rcontext.h"
#include "sp_cache.h" #include "sp_cache.h"
#include "sql_reload.h" // reload_acl_and_cache
#ifdef HAVE_POLL_H #ifdef HAVE_POLL_H
#include <poll.h> #include <poll.h>
......
...@@ -89,6 +89,49 @@ TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name); ...@@ -89,6 +89,49 @@ TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name);
TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update, TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update,
uint lock_flags); uint lock_flags);
/* mysql_lock_tables() and open_table() flags bits */
#define MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK 0x0001
#define MYSQL_OPEN_IGNORE_FLUSH 0x0002
#define MYSQL_OPEN_TEMPORARY_ONLY 0x0004
#define MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY 0x0008
#define MYSQL_LOCK_LOG_TABLE 0x0010
/**
Do not try to acquire a metadata lock on the table: we
already have one.
*/
#define MYSQL_OPEN_HAS_MDL_LOCK 0x0020
/**
If in locked tables mode, ignore the locked tables and get
a new instance of the table.
*/
#define MYSQL_OPEN_GET_NEW_TABLE 0x0040
/** Don't look up the table in the list of temporary tables. */
#define MYSQL_OPEN_SKIP_TEMPORARY 0x0080
/** Fail instead of waiting when conficting metadata lock is discovered. */
#define MYSQL_OPEN_FAIL_ON_MDL_CONFLICT 0x0100
/** Open tables using MDL_SHARED lock instead of one specified in parser. */
#define MYSQL_OPEN_FORCE_SHARED_MDL 0x0200
/**
Open tables using MDL_SHARED_HIGH_PRIO lock instead of one specified
in parser.
*/
#define MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL 0x0400
/**
When opening or locking the table, use the maximum timeout
(LONG_TIMEOUT = 1 year) rather than the user-supplied timeout value.
*/
#define MYSQL_LOCK_IGNORE_TIMEOUT 0x0800
/** Please refer to the internals manual. */
#define MYSQL_OPEN_REOPEN (MYSQL_OPEN_IGNORE_FLUSH |\
MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |\
MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY |\
MYSQL_LOCK_IGNORE_TIMEOUT |\
MYSQL_OPEN_GET_NEW_TABLE |\
MYSQL_OPEN_SKIP_TEMPORARY |\
MYSQL_OPEN_HAS_MDL_LOCK)
bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
Open_table_context *ot_ctx); Open_table_context *ot_ctx);
bool open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias, bool open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias,
......
This diff is collapsed.
...@@ -93,8 +93,6 @@ void mysql_init_multi_delete(LEX *lex); ...@@ -93,8 +93,6 @@ void mysql_init_multi_delete(LEX *lex);
bool multi_delete_set_locks_and_link_aux_tables(LEX *lex); bool multi_delete_set_locks_and_link_aux_tables(LEX *lex);
void create_table_set_open_action_and_adjust_tables(LEX *lex); void create_table_set_open_action_and_adjust_tables(LEX *lex);
pthread_handler_t handle_bootstrap(void *arg); pthread_handler_t handle_bootstrap(void *arg);
bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
bool *write_to_binlog);
int mysql_execute_command(THD *thd); int mysql_execute_command(THD *thd);
bool do_command(THD *thd); bool do_command(THD *thd);
void do_handle_bootstrap(THD *thd); void do_handle_bootstrap(THD *thd);
......
This diff is collapsed.
#ifndef SQL_RELOAD_INCLUDED
#define SQL_RELOAD_INCLUDED
/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
class THD;
struct TABLE_LIST;
bool reload_acl_and_cache(THD *thd, unsigned long options,
TABLE_LIST *tables, bool *write_to_binlog);
bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment