From 1ad5bb1a69656808312efc40ca12c4897f8ea128 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 22 Dec 2009 10:35:56 +0100 Subject: WL#4738 streamline/simplify @@variable creation process Bug#16565 mysqld --help --verbose does not order variablesBug#20413 sql_slave_skip_counter is not shown in show variables Bug#20415 Output of mysqld --help --verbose is incomplete Bug#25430 variable not found in SELECT @@global.ft_max_word_len; Bug#32902 plugin variables don't know their names Bug#34599 MySQLD Option and Variable Reference need to be consistent in formatting! Bug#34829 No default value for variable and setting default does not raise error Bug#34834 ? Is accepted as a valid sql mode Bug#34878 Few variables have default value according to documentation but error occurs Bug#34883 ft_boolean_syntax cant be assigned from user variable to global var. Bug#37187 `INFORMATION_SCHEMA`.`GLOBAL_VARIABLES`: inconsistent status Bug#40988 log_output_basic.test succeeded though syntactically false. Bug#41010 enum-style command-line options are not honoured (maria.maria-recover fails) Bug#42103 Setting key_buffer_size to a negative value may lead to very large allocations Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled Bug#44797 plugins w/o command-line options have no disabling option in --help Bug#46314 string system variables don't support expressions Bug#46470 sys_vars.max_binlog_cache_size_basic_32 is broken Bug#46586 When using the plugin interface the type "set" for options caused a crash. Bug#47212 Crash in DBUG_PRINT in mysqltest.cc when trying to print octal number Bug#48758 mysqltest crashes on sys_vars.collation_server_basic in gcov builds Bug#49417 some complaints about mysqld --help --verbose output Bug#49540 DEFAULT value of binlog_format isn't the default value Bug#49640 ambiguous option '--skip-skip-myisam' (double skip prefix) Bug#49644 init_connect and \0 Bug#49645 init_slave and multi-byte characters Bug#49646 mysql --show-warnings crashes when server dies CMakeLists.txt: Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled client/mysql.cc: don't crash with --show-warnings when mysqld dies config/ac-macros/plugins.m4: Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled include/my_getopt.h: comments include/my_pthread.h: fix double #define mysql-test/mysql-test-run.pl: run sys_vars suite by default properly recognize envirinment variables (e.g. MTR_MAX_SAVE_CORE) set to 0 escape gdb command line arguments mysql-test/suite/sys_vars/r/rpl_init_slave_func.result: init_slave+utf8 bug mysql-test/suite/sys_vars/t/rpl_init_slave_func.test: init_slave+utf8 bug mysys/my_getopt.c: Bug#34599 MySQLD Option and Variable Reference need to be consistent in formatting! Bug#46586 When using the plugin interface the type "set" for options caused a crash. Bug#49640 ambiguous option '--skip-skip-myisam' (double skip prefix) mysys/typelib.c: support for flagset sql/ha_ndbcluster.cc: backport from telco tree sql/item_func.cc: Bug#49644 init_connect and \0 Bug#49645 init_slave and multi-byte characters sql/sql_builtin.cc.in: Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled sql/sql_plugin.cc: Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled Bug#32902 plugin variables don't know their names Bug#44797 plugins w/o command-line options have no disabling option in --help sql/sys_vars.cc: all server variables are defined here storage/myisam/ft_parser.c: remove unnecessary updates of param->quot storage/myisam/ha_myisam.cc: myisam_* variables belong here strings/my_vsnprintf.c: %o and %llx unittest/mysys/my_vsnprintf-t.c: %o and %llx tests vio/viosocket.c: bugfix: fix @@wait_timeout to work with socket timeouts (vs. alarm thread) --- sql/sql_repl.cc | 151 +++----------------------------------------------------- 1 file changed, 8 insertions(+), 143 deletions(-) (limited to 'sql/sql_repl.cc') diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index aa06b1cfb0e..517fbb97b73 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -29,6 +29,14 @@ my_bool opt_sporadic_binlog_dump_fail = 0; static int binlog_dump_count = 0; #endif +/** + a copy of active_mi->rli->slave_skip_counter, for showing in SHOW VARIABLES, + INFORMATION_SCHEMA.GLOBAL_VARIABLES and @@sql_slave_skip_counter without + taking all the mutexes needed to access active_mi->rli->slave_skip_counter + properly. +*/ +uint sql_slave_skip_counter; + /* fake_rotate_event() builds a fake (=which does not exist physically in any binlog) Rotate event, which contains the name of the binlog we are going to @@ -1985,147 +1993,4 @@ int log_loaded_block(IO_CACHE* file) DBUG_RETURN(0); } -/* - Replication System Variables -*/ - -class sys_var_slave_skip_counter :public sys_var -{ -public: - sys_var_slave_skip_counter(sys_var_chain *chain, const char *name_arg) - :sys_var(name_arg) - { chain_sys_var(chain); } - bool check(THD *thd, set_var *var); - bool update(THD *thd, set_var *var); - bool check_type(enum_var_type type) { return type != OPT_GLOBAL; } - /* - We can't retrieve the value of this, so we don't have to define - type() or value_ptr() - */ -}; - -class sys_var_sync_binlog_period :public sys_var_long_ptr -{ -public: - sys_var_sync_binlog_period(sys_var_chain *chain, const char *name_arg, - ulong *value_ptr) - :sys_var_long_ptr(chain, name_arg,value_ptr) {} - bool update(THD *thd, set_var *var); -}; - -static void fix_slave_net_timeout(THD *thd, enum_var_type type) -{ - DBUG_ENTER("fix_slave_net_timeout"); -#ifdef HAVE_REPLICATION - pthread_mutex_lock(&LOCK_active_mi); - DBUG_PRINT("info",("slave_net_timeout=%lu mi->heartbeat_period=%.3f", - slave_net_timeout, - (active_mi? active_mi->heartbeat_period : 0.0))); - if (active_mi && slave_net_timeout < active_mi->heartbeat_period) - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, - "The currect value for master_heartbeat_period" - " exceeds the new value of `slave_net_timeout' sec." - " A sensible value for the period should be" - " less than the timeout."); - pthread_mutex_unlock(&LOCK_active_mi); -#endif - DBUG_VOID_RETURN; -} - -static sys_var_chain vars = { NULL, NULL }; - -static sys_var_const sys_log_slave_updates(&vars, "log_slave_updates", - OPT_GLOBAL, SHOW_MY_BOOL, - (uchar*) &opt_log_slave_updates); -static sys_var_const sys_relay_log(&vars, "relay_log", - OPT_GLOBAL, SHOW_CHAR_PTR, - (uchar*) &opt_relay_logname); -static sys_var_const sys_relay_log_index(&vars, "relay_log_index", - OPT_GLOBAL, SHOW_CHAR_PTR, - (uchar*) &opt_relaylog_index_name); -static sys_var_const sys_relay_log_info_file(&vars, "relay_log_info_file", - OPT_GLOBAL, SHOW_CHAR_PTR, - (uchar*) &relay_log_info_file); -static sys_var_bool_ptr sys_relay_log_purge(&vars, "relay_log_purge", - &relay_log_purge); -static sys_var_bool_ptr sys_relay_log_recovery(&vars, "relay_log_recovery", - &relay_log_recovery); -static sys_var_uint_ptr sys_sync_binlog_period(&vars, "sync_binlog", - &sync_binlog_period); -static sys_var_uint_ptr sys_sync_relaylog_period(&vars, "sync_relay_log", - &sync_relaylog_period); -static sys_var_uint_ptr sys_sync_relayloginfo_period(&vars, "sync_relay_log_info", - &sync_relayloginfo_period); -static sys_var_uint_ptr sys_sync_masterinfo_period(&vars, "sync_master_info", - &sync_masterinfo_period); -static sys_var_const sys_relay_log_space_limit(&vars, - "relay_log_space_limit", - OPT_GLOBAL, SHOW_LONGLONG, - (uchar*) - &relay_log_space_limit); -static sys_var_const sys_slave_load_tmpdir(&vars, "slave_load_tmpdir", - OPT_GLOBAL, SHOW_CHAR_PTR, - (uchar*) &slave_load_tmpdir); -static sys_var_long_ptr sys_slave_net_timeout(&vars, "slave_net_timeout", - &slave_net_timeout, - fix_slave_net_timeout); -static sys_var_const sys_slave_skip_errors(&vars, "slave_skip_errors", - OPT_GLOBAL, SHOW_CHAR, - (uchar*) slave_skip_error_names); -static sys_var_long_ptr sys_slave_trans_retries(&vars, "slave_transaction_retries", - &slave_trans_retries); -static sys_var_slave_skip_counter sys_slave_skip_counter(&vars, "sql_slave_skip_counter"); - - -bool sys_var_slave_skip_counter::check(THD *thd, set_var *var) -{ - int result= 0; - pthread_mutex_lock(&LOCK_active_mi); - pthread_mutex_lock(&active_mi->rli.run_lock); - if (active_mi->rli.slave_running) - { - my_message(ER_SLAVE_MUST_STOP, ER(ER_SLAVE_MUST_STOP), MYF(0)); - result=1; - } - pthread_mutex_unlock(&active_mi->rli.run_lock); - pthread_mutex_unlock(&LOCK_active_mi); - var->save_result.ulong_value= (ulong) var->value->val_int(); - return result; -} - - -bool sys_var_slave_skip_counter::update(THD *thd, set_var *var) -{ - pthread_mutex_lock(&LOCK_active_mi); - pthread_mutex_lock(&active_mi->rli.run_lock); - /* - The following test should normally never be true as we test this - in the check function; To be safe against multiple - SQL_SLAVE_SKIP_COUNTER request, we do the check anyway - */ - if (!active_mi->rli.slave_running) - { - pthread_mutex_lock(&active_mi->rli.data_lock); - active_mi->rli.slave_skip_counter= var->save_result.ulong_value; - pthread_mutex_unlock(&active_mi->rli.data_lock); - } - pthread_mutex_unlock(&active_mi->rli.run_lock); - pthread_mutex_unlock(&LOCK_active_mi); - return 0; -} - - -int init_replication_sys_vars() -{ - if (mysql_add_sys_var_chain(vars.first, my_long_options)) - { - /* should not happen */ - fprintf(stderr, "failed to initialize replication system variables"); - unireg_abort(1); - } - return 0; -} - - #endif /* HAVE_REPLICATION */ -- cgit v1.2.1