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/rpl_mi.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/rpl_mi.cc')
-rw-r--r-- | sql/rpl_mi.cc | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 366b271851a..1491d970472 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -622,27 +622,34 @@ bool check_master_connection_name(LEX_STRING *name) res_file_name Store result here length Length of res_file_name buffer info_file Original file name (prefix) - separator Separator character + append 1 if we should add suffix last (not before ext) suffix Suffix @note + The suffix is added before the extension of the file name prefixed with '-'. + The suffix is also converted to lower case and we transform + all not safe character, as we do with MySQL table names. + If suffix is an empty string, then we don't add any suffix. This is to allow one to use this function also to generate old file names without a prefix. */ void create_signed_file_name(char *res_file_name, uint length, - const char *info_file, - char separator, LEX_STRING *suffix) + const char *info_file, bool append, + LEX_STRING *suffix) { char buff[MAX_CONNECTION_NAME+1], res[MAX_CONNECTION_NAME+1], *p; + p= strmake(res_file_name, info_file, length); - if (suffix->length != 0 && p != info_file + length) + /* If not empty suffix and there is place left for some part of the suffix */ + if (suffix->length != 0 && p <= res_file_name + length -1) { + const char *info_file_end= info_file + (p - res_file_name); + const char *ext= append ? info_file_end : fn_ext2(info_file); + size_t res_length, ext_pos; uint errors; - size_t res_length; - *p++= separator; /* Create null terminated string */ strmake(buff, suffix->str, suffix->length); /* Convert to lower case */ @@ -650,7 +657,14 @@ void create_signed_file_name(char *res_file_name, uint length, /* Convert to characters usable in a file name */ res_length= strconvert(system_charset_info, buff, &my_charset_filename, res, sizeof(res), &errors); - strmake(p, res, min(length - (p - res_file_name), res_length)); + + ext_pos= (size_t) (ext - info_file); + length-= (suffix->length - ext_pos); /* Leave place for extension */ + p= res_file_name + ext_pos; + *p++= '-'; /* Add separator */ + p= strmake(p, res, min(length - (p - res_file_name), res_length)); + /* Add back extension. We have checked above that there is space for it */ + strmov(p, ext); } } @@ -748,10 +762,10 @@ bool Master_info_index::init_all_master_info() init_thread_mask(&thread_mask,mi,0 /*not inverse*/); create_signed_file_name(buf_master_info_file, sizeof(buf_master_info_file), - master_info_file, '.', &connection_name); + master_info_file, 0, &connection_name); create_signed_file_name(buf_relay_log_info_file, sizeof(buf_relay_log_info_file), - relay_log_info_file, '.', &connection_name); + relay_log_info_file, 0, &connection_name); if (global_system_variables.log_warnings > 1) sql_print_information("Reading Master_info: '%s' Relay_info:'%s'", buf_master_info_file, buf_relay_log_info_file); |