diff options
author | Michael Widenius <monty@askmonty.org> | 2012-10-01 02:30:44 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2012-10-01 02:30:44 +0300 |
commit | 8ac1b41cf358029b8e08e977f45bb6197a1c1c19 (patch) | |
tree | 2e77415664e1f259259f393da8b22effa1493a07 /sql/sys_vars.cc | |
parent | 5a4b5869a039bd50ce5a040114ede77bbae58c80 (diff) | |
download | mariadb-git-8ac1b41cf358029b8e08e977f45bb6197a1c1c19.tar.gz |
Made max_relay_log_size depending on master connection.
Changed names of multi-source log files so that original suffixes are kept.
include/my_sys.h:
Added fn_ext2(), which returns pointer to last '.' in file name
mysql-test/extra/rpl_tests/rpl_max_relay_size.test:
Updated test
mysql-test/suite/multi_source/info_logs-master.opt:
Test with strange file names
mysql-test/suite/multi_source/info_logs.result:
Updated results
mysql-test/suite/multi_source/info_logs.test:
Changed to test with complex names to be able to verify the filename generator code
mysql-test/suite/multi_source/relaylog_events.result:
Updated results
mysql-test/suite/multi_source/reset_slave.result:
Updated results
mysql-test/suite/multi_source/skip_counter.result:
Updated results
mysql-test/suite/multi_source/skip_counter.test:
Added testing of max_relay_log_size
mysql-test/suite/rpl/r/rpl_row_max_relay_size.result:
Updated results
mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result:
Updated results
mysql-test/suite/sys_vars/r/max_relay_log_size_basic.result:
Updated results
mysql-test/suite/sys_vars/t/max_relay_log_size_basic.test:
Updated results
mysys/mf_fn_ext.c:
Added fn_ext2(), which returns pointer to last '.' in file name
sql/log.cc:
Removed some wrong casts
sql/log.h:
Updated comment to reflect new code
sql/log_event.cc:
Updated DBUG_PRINT
sql/mysqld.cc:
Added that max_relay_log_size copies it's values from max_binlog_size
sql/mysqld.h:
Removed max_relay_log_size
sql/rpl_mi.cc:
Changed names of multi-source log files so that original suffixes are kept.
sql/rpl_mi.h:
Updated prototype
sql/rpl_rli.cc:
Updated comment to reflect new code
Made max_relay_log_size depending on master connection.
sql/rpl_rli.h:
Made max_relay_log_size depending on master connection.
sql/set_var.h:
Made option global so that one can check and change min & max values (sorry Sergei)
sql/sql_class.h:
Made max_relay_log_size depending on master connection.
sql/sql_repl.cc:
Updated calls to create_signed_file_name()
sql/sys_vars.cc:
Made max_relay_log_size depending on master connection.
Made old code more reusable
sql/sys_vars.h:
Changed Sys_var_multi_source_uint to ulong to be able to handle max_relay_log_size
Made old code more reusable
Diffstat (limited to 'sql/sys_vars.cc')
-rw-r--r-- | sql/sys_vars.cc | 83 |
1 files changed, 45 insertions, 38 deletions
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 30cfe1a5680..9421dca5c05 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1105,16 +1105,12 @@ static Sys_var_ulonglong Sys_max_binlog_stmt_cache_size( static bool fix_max_binlog_size(sys_var *self, THD *thd, enum_var_type type) { mysql_bin_log.set_max_size(max_binlog_size); -#ifdef HAVE_REPLICATION - if (!max_relay_log_size) - active_mi->rli.relay_log.set_max_size(max_binlog_size); -#endif return false; } static Sys_var_ulong Sys_max_binlog_size( "max_binlog_size", "Binary log will be rotated automatically when the size exceeds this " - "value. Will also apply to relay logs if max_relay_log_size is 0", + "value.", GLOBAL_VAR(max_binlog_size), CMD_LINE(REQUIRED_ARG), VALID_RANGE(IO_SIZE, 1024*1024L*1024L), DEFAULT(1024*1024L*1024L), BLOCK_SIZE(IO_SIZE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), @@ -1259,24 +1255,6 @@ static Sys_var_ulong Sys_max_prepared_stmt_count( VALID_RANGE(0, 1024*1024), DEFAULT(16382), BLOCK_SIZE(1), &PLock_prepared_stmt_count); -static bool fix_max_relay_log_size(sys_var *self, THD *thd, enum_var_type type) -{ -#ifdef HAVE_REPLICATION - active_mi->rli.relay_log.set_max_size(max_relay_log_size ? - max_relay_log_size: max_binlog_size); -#endif - return false; -} -static Sys_var_ulong Sys_max_relay_log_size( - "max_relay_log_size", - "If non-zero: relay log will be rotated automatically when the " - "size exceeds this value; if zero: when the size " - "exceeds max_binlog_size", - GLOBAL_VAR(max_relay_log_size), CMD_LINE(REQUIRED_ARG), - VALID_RANGE(0, 1024L*1024*1024), DEFAULT(0), BLOCK_SIZE(IO_SIZE), - NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), - ON_UPDATE(fix_max_relay_log_size)); - static Sys_var_ulong Sys_max_sort_length( "max_sort_length", "The number of bytes to use when sorting BLOB or TEXT values (only " @@ -3459,7 +3437,7 @@ static bool fix_slave_net_timeout(sys_var *self, THD *thd, enum_var_type type) mysql_mutex_unlock(&LOCK_global_system_variables); mysql_mutex_lock(&LOCK_active_mi); - DBUG_PRINT("info", ("slave_net_timeout=%u mi->heartbeat_period=%.3f", + DBUG_PRINT("info", ("slave_net_timeout: %u 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) @@ -3484,7 +3462,7 @@ static Sys_var_uint Sys_slave_net_timeout( Return 0 + warning if it doesn't exist */ -uint Sys_var_multi_source_uint:: +uint Sys_var_multi_source_ulong:: get_master_info_uint_value(THD *thd, ptrdiff_t offset) { Master_info *mi; @@ -3504,11 +3482,13 @@ get_master_info_uint_value(THD *thd, ptrdiff_t offset) } -static bool update_slave_skip_counter(sys_var *self, THD *thd, - enum_var_type type) +bool update_multi_source_variable(sys_var *self_var, THD *thd, + enum_var_type type) { + Sys_var_multi_source_ulong *self= (Sys_var_multi_source_ulong*) self_var; bool result= true; Master_info *mi; + mysql_mutex_lock(&LOCK_active_mi); mi= master_info_index-> get_master_info(&thd->variables.default_master_connection, @@ -3516,30 +3496,57 @@ static bool update_slave_skip_counter(sys_var *self, THD *thd, if (mi) { mysql_mutex_lock(&mi->rli.run_lock); - if (mi->rli.slave_running) - my_message(ER_SLAVE_MUST_STOP, ER(ER_SLAVE_MUST_STOP), MYF(0)); - else - { - result= false; // ok - mysql_mutex_lock(&mi->rli.data_lock); - /* The value was stored temporarly in thd */ - mi->rli.slave_skip_counter= thd->variables.slave_skip_counter; - mysql_mutex_unlock(&mi->rli.data_lock); - } + mysql_mutex_lock(&mi->rli.data_lock); + result= self->update_variable(thd, mi); + mysql_mutex_unlock(&mi->rli.data_lock); mysql_mutex_unlock(&mi->rli.run_lock); } mysql_mutex_unlock(&LOCK_active_mi); return result; } -static Sys_var_multi_source_uint +static bool update_slave_skip_counter(sys_var *self, THD *thd, Master_info *mi) +{ + if (mi->rli.slave_running) + { + my_message(ER_SLAVE_MUST_STOP, ER(ER_SLAVE_MUST_STOP), MYF(0)); + return true; + } + /* The value was stored temporarly in thd */ + mi->rli.slave_skip_counter= thd->variables.slave_skip_counter; + return false; +} + + +static Sys_var_multi_source_ulong Sys_slave_skip_counter("sql_slave_skip_counter", "Skip the next N events from the master log", SESSION_VAR(slave_skip_counter), + NO_CMD_LINE, offsetof(Master_info, rli.slave_skip_counter), VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1), ON_UPDATE(update_slave_skip_counter)); + +static bool update_max_relay_log_size(sys_var *self, THD *thd, Master_info *mi) +{ + mi->rli.max_relay_log_size= thd->variables.max_relay_log_size; + mi->rli.relay_log.set_max_size(mi->rli.max_relay_log_size); + return false; +} + +static Sys_var_multi_source_ulong +Sys_max_relay_log_size( "max_relay_log_size", + "relay log will be rotated automatically when the " + "size exceeds this value. If 0 are startup, it's " + "set to max_binlog_size", + SESSION_VAR(max_relay_log_size), + CMD_LINE(REQUIRED_ARG), + offsetof(Master_info, rli.max_relay_log_size), + VALID_RANGE(0, 1024L*1024*1024), DEFAULT(0), + BLOCK_SIZE(IO_SIZE), + ON_UPDATE(update_max_relay_log_size)); + static Sys_var_charptr Sys_slave_skip_errors( "slave_skip_errors", "Tells the slave thread to continue " "replication when a query event returns an error from the " |