mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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
This commit is contained in:
@ -679,6 +679,7 @@ extern my_bool has_path(const char *name);
|
||||
extern char *convert_dirname(char *to, const char *from, const char *from_end);
|
||||
extern void to_unix_path(char * name);
|
||||
extern char * fn_ext(const char *name);
|
||||
extern char * fn_ext2(const char *name);
|
||||
extern char * fn_same(char * toname,const char *name,int flag);
|
||||
extern char * fn_format(char * to,const char *name,const char *dir,
|
||||
const char *form, uint flag);
|
||||
|
@ -34,7 +34,7 @@ reset slave;
|
||||
--echo # Test 1
|
||||
--echo #
|
||||
|
||||
set @my_max_binlog_size= @@global.max_binlog_size;
|
||||
set @my_max_binlog_size= @@global.max_binlog_size, @my_max_relay_log_size=@@global.max_relay_log_size;
|
||||
set global max_binlog_size=8192;
|
||||
set global max_relay_log_size=8192-1; # mapped to 4096
|
||||
select @@global.max_relay_log_size;
|
||||
@ -110,6 +110,7 @@ source include/show_master_status.inc;
|
||||
# Restore max_binlog_size
|
||||
connection slave;
|
||||
set global max_binlog_size= @my_max_binlog_size;
|
||||
set global max_relay_log_size= @my_max_relay_log_size;
|
||||
|
||||
--echo #
|
||||
--echo # End of 4.1 tests
|
||||
|
1
mysql-test/suite/multi_source/info_logs-master.opt
Normal file
1
mysql-test/suite/multi_source/info_logs-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--relay-log=relay.bin --relay-log-info=relay.bin.info
|
@ -15,35 +15,35 @@ set default_master_connection = 'master1';
|
||||
include/wait_for_slave_to_start.inc
|
||||
#
|
||||
# List of files matching '*info*' pattern while 'master1' is running
|
||||
master.info.master1
|
||||
master-master1.info
|
||||
multi-master.info
|
||||
relay-log.info.master1
|
||||
relay.bin-master1.info
|
||||
# End of list
|
||||
#
|
||||
# Contents of multi-master.info
|
||||
master1
|
||||
# EOF
|
||||
#
|
||||
change master 'master2' to
|
||||
change master 'MASTER 2.2' to
|
||||
master_port=MYPORT_2,
|
||||
master_host='127.0.0.1',
|
||||
master_user='root';
|
||||
start slave 'master2';
|
||||
set default_master_connection = 'master2';
|
||||
start slave 'MASTER 2.2';
|
||||
set default_master_connection = 'MASTER 2.2';
|
||||
include/wait_for_slave_to_start.inc
|
||||
#
|
||||
# List of files matching '*info*' pattern
|
||||
# while 'master1' and 'master2' are running
|
||||
master.info.master1
|
||||
master.info.master2
|
||||
# while 'master1' and 'MASTER 2.2' are running
|
||||
master-master1.info
|
||||
master-master@00202@002e2.info
|
||||
multi-master.info
|
||||
relay-log.info.master1
|
||||
relay-log.info.master2
|
||||
relay.bin-master1.info
|
||||
relay.bin-master@00202@002e2.info
|
||||
# End of list
|
||||
#
|
||||
# Contents of multi-master.info
|
||||
master1
|
||||
master2
|
||||
MASTER 2.2
|
||||
# EOF
|
||||
#
|
||||
stop slave 'master1';
|
||||
@ -52,14 +52,14 @@ include/wait_for_slave_to_stop.inc
|
||||
reset slave 'master1' all;
|
||||
#
|
||||
# List of files matching '*info*' pattern
|
||||
# after 'master1' was completely reset, 'master2' still running
|
||||
master.info.master2
|
||||
# after 'master1' was completely reset, 'MASTER 2.2' still running
|
||||
master-master@00202@002e2.info
|
||||
multi-master.info
|
||||
relay-log.info.master2
|
||||
relay.bin-master@00202@002e2.info
|
||||
# End of list
|
||||
#
|
||||
# Contents of multi-master.info
|
||||
master2
|
||||
MASTER 2.2
|
||||
# EOF
|
||||
#
|
||||
set default_master_connection = '';
|
||||
@ -71,44 +71,44 @@ start slave;
|
||||
include/wait_for_slave_to_start.inc
|
||||
#
|
||||
# List of files matching '*info*' pattern
|
||||
# while 'master2' and '' are running
|
||||
# while 'MASTER 2.2' and '' are running
|
||||
master-master@00202@002e2.info
|
||||
master.info
|
||||
master.info.master2
|
||||
multi-master.info
|
||||
relay-log.info
|
||||
relay-log.info.master2
|
||||
relay.bin-master@00202@002e2.info
|
||||
relay.bin.info
|
||||
# End of list
|
||||
#
|
||||
# Contents of multi-master.info
|
||||
master2
|
||||
MASTER 2.2
|
||||
# EOF
|
||||
#
|
||||
show full slave status;
|
||||
Connection_name Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
|
||||
Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 mysqld-relay-bin.000002 572 master-bin.000001 Yes Yes 0 0 286 868 None 0 No 0 No 0 0 1
|
||||
master2 Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin-master2.000002 572 master-bin.000001 Yes Yes 0 0 286 876 None 0 No 0 No 0 0 2
|
||||
Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 relay.000002 572 master-bin.000001 Yes Yes 0 0 286 857 None 0 No 0 No 0 0 1
|
||||
MASTER 2.2 Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 relay-master@00202@002e2.000002 572 master-bin.000001 Yes Yes 0 0 286 876 None 0 No 0 No 0 0 2
|
||||
show full slave status;
|
||||
Connection_name Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
|
||||
Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 mysqld-relay-bin.000004 532 master-bin.000001 Yes Yes 0 0 286 828 None 0 No 0 No 0 0 1
|
||||
master2 Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin-master2.000004 532 master-bin.000001 Yes Yes 0 0 286 836 None 0 No 0 No 0 0 2
|
||||
Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 relay.000004 532 master-bin.000001 Yes Yes 0 0 286 817 None 0 No 0 No 0 0 1
|
||||
MASTER 2.2 Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 relay-master@00202@002e2.000004 532 master-bin.000001 Yes Yes 0 0 286 836 None 0 No 0 No 0 0 2
|
||||
#
|
||||
# List of files matching '*info*' pattern
|
||||
# after slave server restart
|
||||
# while 'master2' and '' are running
|
||||
# while 'MASTER 2.2' and '' are running
|
||||
master-master@00202@002e2.info
|
||||
master.info
|
||||
master.info.master2
|
||||
multi-master.info
|
||||
relay-log.info
|
||||
relay-log.info.master2
|
||||
relay.bin-master@00202@002e2.info
|
||||
relay.bin.info
|
||||
# End of list
|
||||
#
|
||||
# Contents of multi-master.info
|
||||
master2
|
||||
MASTER 2.2
|
||||
# EOF
|
||||
#
|
||||
stop slave;
|
||||
include/wait_for_slave_to_stop.inc
|
||||
set default_master_connection = 'master2';
|
||||
set default_master_connection = 'MASTER 2.2';
|
||||
stop slave;
|
||||
include/wait_for_slave_to_stop.inc
|
||||
reset slave all;
|
||||
|
@ -47,20 +47,20 @@ set default_master_connection = 'master1';
|
||||
# Start replication from the second master
|
||||
|
||||
--replace_result $SERVER_MYPORT_2 MYPORT_2
|
||||
eval change master 'master2' to
|
||||
eval change master 'MASTER 2.2' to
|
||||
master_port=$SERVER_MYPORT_2,
|
||||
master_host='127.0.0.1',
|
||||
master_user='root';
|
||||
|
||||
start slave 'master2';
|
||||
set default_master_connection = 'master2';
|
||||
start slave 'MASTER 2.2';
|
||||
set default_master_connection = 'MASTER 2.2';
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
|
||||
# Check the files
|
||||
|
||||
--echo #
|
||||
--echo # List of files matching '*info*' pattern
|
||||
--echo # while 'master1' and 'master2' are running
|
||||
--echo # while 'master1' and 'MASTER 2.2' are running
|
||||
--list_files $datadir *info*
|
||||
--echo # End of list
|
||||
--echo #
|
||||
@ -80,7 +80,7 @@ reset slave 'master1' all;
|
||||
|
||||
--echo #
|
||||
--echo # List of files matching '*info*' pattern
|
||||
--echo # after 'master1' was completely reset, 'master2' still running
|
||||
--echo # after 'master1' was completely reset, 'MASTER 2.2' still running
|
||||
--list_files $datadir *info*
|
||||
--echo # End of list
|
||||
--echo #
|
||||
@ -106,7 +106,7 @@ start slave;
|
||||
|
||||
--echo #
|
||||
--echo # List of files matching '*info*' pattern
|
||||
--echo # while 'master2' and '' are running
|
||||
--echo # while 'MASTER 2.2' and '' are running
|
||||
--list_files $datadir *info*
|
||||
--echo # End of list
|
||||
--echo #
|
||||
@ -136,7 +136,7 @@ show full slave status;
|
||||
--echo #
|
||||
--echo # List of files matching '*info*' pattern
|
||||
--echo # after slave server restart
|
||||
--echo # while 'master2' and '' are running
|
||||
--echo # while 'MASTER 2.2' and '' are running
|
||||
--list_files $datadir *info*
|
||||
--echo # End of list
|
||||
--echo #
|
||||
@ -151,7 +151,7 @@ show full slave status;
|
||||
stop slave;
|
||||
--source include/wait_for_slave_to_stop.inc
|
||||
|
||||
set default_master_connection = 'master2';
|
||||
set default_master_connection = 'MASTER 2.2';
|
||||
stop slave;
|
||||
--source include/wait_for_slave_to_stop.inc
|
||||
reset slave all;
|
||||
|
@ -9,6 +9,7 @@ drop table if exists t1;
|
||||
create table t1 (i int) engine=MyISAM;
|
||||
mysqld-relay-bin-master1.000001
|
||||
mysqld-relay-bin-master1.000002
|
||||
mysqld-relay-bin-master1.index
|
||||
show relaylog events in 'mysqld-relay-bin-master1.000002';
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
mysqld-relay-bin-master1.000002 4 Format_desc 3 246 Server version
|
||||
|
@ -14,7 +14,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
|
||||
127.0.0.1 root MYPORT_1 60 master-bin.000001 729 mysqld-relay-bin-master1.000002 1015 master-bin.000001 No No 0 0 729 1319 None 0 No NULL No 0 0 1
|
||||
mysqld-relay-bin-master1.000001
|
||||
mysqld-relay-bin-master1.000002
|
||||
mysqld-relay-bin.index-master1
|
||||
mysqld-relay-bin-master1.index
|
||||
reset slave 'master1';
|
||||
show slave 'master1' status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id
|
||||
|
@ -55,6 +55,49 @@ set default_master_connection = 'master2';
|
||||
select @@session.sql_slave_skip_counter;
|
||||
@@session.sql_slave_skip_counter
|
||||
3
|
||||
select @@global.max_relay_log_size;
|
||||
@@global.max_relay_log_size
|
||||
1073741824
|
||||
set global max_relay_log_size = 1*1024*1024;
|
||||
select @@global.max_relay_log_size;
|
||||
@@global.max_relay_log_size
|
||||
1048576
|
||||
select @@session.max_relay_log_size;
|
||||
@@session.max_relay_log_size
|
||||
1048576
|
||||
set session max_relay_log_size = 3*1024*1024;
|
||||
select @@global.max_relay_log_size;
|
||||
@@global.max_relay_log_size
|
||||
3145728
|
||||
select @@session.max_relay_log_size;
|
||||
@@session.max_relay_log_size
|
||||
3145728
|
||||
set global max_relay_log_size= default;
|
||||
select @@global.max_relay_log_size;
|
||||
@@global.max_relay_log_size
|
||||
1073741824
|
||||
select @@session.max_relay_log_size;
|
||||
@@session.max_relay_log_size
|
||||
1073741824
|
||||
set global max_relay_log_size= 3*1024*1024;
|
||||
set default_master_connection = 'master1';
|
||||
select @@session.max_relay_log_size;
|
||||
@@session.max_relay_log_size
|
||||
1073741824
|
||||
set default_master_connection = 'qqq';
|
||||
select @@session.max_relay_log_size;
|
||||
@@session.max_relay_log_size
|
||||
0
|
||||
Warnings:
|
||||
Warning 1617 There is no master connection 'qqq'
|
||||
set default_master_connection = 'master2';
|
||||
select @@session.max_relay_log_size;
|
||||
@@session.max_relay_log_size
|
||||
3145728
|
||||
set global max_binlog_size= 4*1024*1024;
|
||||
select @@global.max_relay_log_size;
|
||||
@@global.max_relay_log_size
|
||||
3145728
|
||||
start slave 'master2';
|
||||
include/wait_for_slave_to_start.inc
|
||||
set default_master_connection = '';
|
||||
@ -72,6 +115,8 @@ set default_master_connection = 'master2';
|
||||
stop slave;
|
||||
include/wait_for_slave_to_stop.inc
|
||||
set global sql_slave_skip_counter = 0;
|
||||
set global max_relay_log_size = 1073741824;
|
||||
set global max_binlog_size = 1073741824;
|
||||
disconnect slave;
|
||||
connection master1;
|
||||
drop database db;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Test of sql_slave_skip_counter
|
||||
# Test of sql_slave_skip_counter and rpl_max_size
|
||||
#
|
||||
|
||||
--enable_connect_log
|
||||
@ -16,7 +16,6 @@ create database db;
|
||||
create table db.t1 (i int) engine=MyISAM;
|
||||
--save_master_pos
|
||||
|
||||
|
||||
# Create the same schema and another table
|
||||
# on the 2nd master
|
||||
|
||||
@ -62,6 +61,8 @@ master_user='root';
|
||||
# to modify the test later
|
||||
|
||||
--let $skip_counter_saved = `select @@global.sql_slave_skip_counter`
|
||||
--let $max_relay_log_size_saved= `select @@global.max_relay_log_size`
|
||||
--let $max_binlog_size_saved= `select @@global.max_binlog_size`
|
||||
set global sql_slave_skip_counter = 2;
|
||||
select @@global.sql_slave_skip_counter;
|
||||
select @@session.sql_slave_skip_counter;
|
||||
@ -79,6 +80,28 @@ select @@session.sql_slave_skip_counter;
|
||||
set default_master_connection = 'master2';
|
||||
select @@session.sql_slave_skip_counter;
|
||||
|
||||
# Test of setting max_relay_log_size
|
||||
select @@global.max_relay_log_size;
|
||||
set global max_relay_log_size = 1*1024*1024;
|
||||
select @@global.max_relay_log_size;
|
||||
select @@session.max_relay_log_size;
|
||||
set session max_relay_log_size = 3*1024*1024;
|
||||
select @@global.max_relay_log_size;
|
||||
select @@session.max_relay_log_size;
|
||||
set global max_relay_log_size= default;
|
||||
select @@global.max_relay_log_size;
|
||||
select @@session.max_relay_log_size;
|
||||
set global max_relay_log_size= 3*1024*1024;
|
||||
set default_master_connection = 'master1';
|
||||
select @@session.max_relay_log_size;
|
||||
set default_master_connection = 'qqq';
|
||||
select @@session.max_relay_log_size;
|
||||
set default_master_connection = 'master2';
|
||||
select @@session.max_relay_log_size;
|
||||
set global max_binlog_size= 4*1024*1024;
|
||||
select @@global.max_relay_log_size;
|
||||
|
||||
|
||||
start slave 'master2';
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
set default_master_connection = '';
|
||||
@ -113,6 +136,8 @@ stop slave;
|
||||
|
||||
--source include/wait_for_slave_to_stop.inc
|
||||
--eval set global sql_slave_skip_counter = $skip_counter_saved
|
||||
--eval set global max_relay_log_size = $max_relay_log_size_saved
|
||||
--eval set global max_binlog_size = $max_binlog_size_saved
|
||||
|
||||
--enable_connect_log
|
||||
--disconnect slave
|
||||
|
@ -10,7 +10,7 @@ reset slave;
|
||||
#
|
||||
# Test 1
|
||||
#
|
||||
set @my_max_binlog_size= @@global.max_binlog_size;
|
||||
set @my_max_binlog_size= @@global.max_binlog_size, @my_max_relay_log_size=@@global.max_relay_log_size;
|
||||
set global max_binlog_size=8192;
|
||||
set global max_relay_log_size=8192-1;
|
||||
Warnings:
|
||||
@ -36,8 +36,10 @@ include/check_slave_is_running.inc
|
||||
stop slave;
|
||||
reset slave;
|
||||
set global max_relay_log_size=0;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect max_relay_log_size value: '0'
|
||||
select @@global.max_relay_log_size;
|
||||
@@global.max_relay_log_size 0
|
||||
@@global.max_relay_log_size 4096
|
||||
start slave;
|
||||
include/check_slave_is_running.inc
|
||||
#
|
||||
@ -65,6 +67,7 @@ show master status;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000002 # <Binlog_Do_DB> <Binlog_Ignore_DB>
|
||||
set global max_binlog_size= @my_max_binlog_size;
|
||||
set global max_relay_log_size= @my_max_relay_log_size;
|
||||
#
|
||||
# End of 4.1 tests
|
||||
#
|
||||
|
@ -10,7 +10,7 @@ reset slave;
|
||||
#
|
||||
# Test 1
|
||||
#
|
||||
set @my_max_binlog_size= @@global.max_binlog_size;
|
||||
set @my_max_binlog_size= @@global.max_binlog_size, @my_max_relay_log_size=@@global.max_relay_log_size;
|
||||
set global max_binlog_size=8192;
|
||||
set global max_relay_log_size=8192-1;
|
||||
Warnings:
|
||||
@ -36,8 +36,10 @@ include/check_slave_is_running.inc
|
||||
stop slave;
|
||||
reset slave;
|
||||
set global max_relay_log_size=0;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect max_relay_log_size value: '0'
|
||||
select @@global.max_relay_log_size;
|
||||
@@global.max_relay_log_size 0
|
||||
@@global.max_relay_log_size 4096
|
||||
start slave;
|
||||
include/check_slave_is_running.inc
|
||||
#
|
||||
@ -65,6 +67,7 @@ show master status;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000002 # <Binlog_Do_DB> <Binlog_Ignore_DB>
|
||||
set global max_binlog_size= @my_max_binlog_size;
|
||||
set global max_relay_log_size= @my_max_relay_log_size;
|
||||
#
|
||||
# End of 4.1 tests
|
||||
#
|
||||
|
@ -1,7 +1,7 @@
|
||||
SET @start_value = @@global.max_relay_log_size;
|
||||
SELECT @start_value;
|
||||
@start_value
|
||||
0
|
||||
1073741824
|
||||
'#--------------------FN_DYNVARS_082_01------------------------#'
|
||||
SET @@global.max_relay_log_size = 5000;
|
||||
Warnings:
|
||||
@ -9,7 +9,7 @@ Warning 1292 Truncated incorrect max_relay_log_size value: '5000'
|
||||
SET @@global.max_relay_log_size = DEFAULT;
|
||||
SELECT @@global.max_relay_log_size;
|
||||
@@global.max_relay_log_size
|
||||
0
|
||||
1073741824
|
||||
'#---------------------FN_DYNVARS_082_02-------------------------#'
|
||||
SET @@global.max_relay_log_size = @start_value;
|
||||
SELECT @@global.max_relay_log_size = 1024;
|
||||
@ -17,15 +17,17 @@ SELECT @@global.max_relay_log_size = 1024;
|
||||
0
|
||||
'#--------------------FN_DYNVARS_082_03------------------------#'
|
||||
SET @@global.max_relay_log_size = 0;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect max_relay_log_size value: '0'
|
||||
SELECT @@global.max_relay_log_size;
|
||||
@@global.max_relay_log_size
|
||||
0
|
||||
4096
|
||||
SET @@global.max_relay_log_size = 1;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect max_relay_log_size value: '1'
|
||||
SELECT @@global.max_relay_log_size;
|
||||
@@global.max_relay_log_size
|
||||
0
|
||||
4096
|
||||
SET @@global.max_relay_log_size = 1073741824;
|
||||
SELECT @@global.max_relay_log_size;
|
||||
@@global.max_relay_log_size
|
||||
@ -48,7 +50,7 @@ Warnings:
|
||||
Warning 1292 Truncated incorrect max_relay_log_size value: '-1'
|
||||
SELECT @@global.max_relay_log_size;
|
||||
@@global.max_relay_log_size
|
||||
0
|
||||
4096
|
||||
SET @@global.max_relay_log_size = 100000000000;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect max_relay_log_size value: '100000000000'
|
||||
@ -65,7 +67,7 @@ Warnings:
|
||||
Warning 1292 Truncated incorrect max_relay_log_size value: '-1024'
|
||||
SELECT @@global.max_relay_log_size;
|
||||
@@global.max_relay_log_size
|
||||
0
|
||||
4096
|
||||
SET @@global.max_relay_log_size = 1073741825;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect max_relay_log_size value: '1073741825'
|
||||
@ -90,9 +92,9 @@ SELECT @@global.max_relay_log_size;
|
||||
1073741824
|
||||
'#-------------------FN_DYNVARS_082_05----------------------------#'
|
||||
SET @@session.max_relay_log_size = 4096;
|
||||
ERROR HY000: Variable 'max_relay_log_size' is a GLOBAL variable and should be set with SET GLOBAL
|
||||
SELECT @@session.max_relay_log_size;
|
||||
ERROR HY000: Variable 'max_relay_log_size' is a GLOBAL variable
|
||||
@@session.max_relay_log_size
|
||||
4096
|
||||
'#----------------------FN_DYNVARS_082_06------------------------#'
|
||||
SELECT @@global.max_relay_log_size = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
@ -110,11 +112,13 @@ Warnings:
|
||||
Warning 1292 Truncated incorrect max_relay_log_size value: '1'
|
||||
SELECT @@global.max_relay_log_size;
|
||||
@@global.max_relay_log_size
|
||||
0
|
||||
4096
|
||||
SET @@global.max_relay_log_size = FALSE;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect max_relay_log_size value: '0'
|
||||
SELECT @@global.max_relay_log_size;
|
||||
@@global.max_relay_log_size
|
||||
0
|
||||
4096
|
||||
'#---------------------FN_DYNVARS_082_08----------------------#'
|
||||
SET @@global.max_relay_log_size = 5000;
|
||||
Warnings:
|
||||
@ -124,7 +128,8 @@ SELECT @@max_relay_log_size = @@global.max_relay_log_size;
|
||||
1
|
||||
'#---------------------FN_DYNVARS_082_09----------------------#'
|
||||
SET max_relay_log_size = 6000;
|
||||
ERROR HY000: Variable 'max_relay_log_size' is a GLOBAL variable and should be set with SET GLOBAL
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect max_relay_log_size value: '6000'
|
||||
SELECT @@max_relay_log_size;
|
||||
@@max_relay_log_size
|
||||
4096
|
||||
@ -141,4 +146,4 @@ ERROR 42S22: Unknown column 'max_relay_log_size' in 'field list'
|
||||
SET @@global.max_relay_log_size = @start_value;
|
||||
SELECT @@global.max_relay_log_size;
|
||||
@@global.max_relay_log_size
|
||||
0
|
||||
1073741824
|
||||
|
@ -105,9 +105,7 @@ SELECT @@global.max_relay_log_size;
|
||||
# Test if accessing session max_relay_log_size gives error #
|
||||
########################################################################
|
||||
|
||||
--Error ER_GLOBAL_VARIABLE
|
||||
SET @@session.max_relay_log_size = 4096;
|
||||
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
|
||||
SELECT @@session.max_relay_log_size;
|
||||
|
||||
|
||||
@ -150,7 +148,6 @@ SELECT @@max_relay_log_size = @@global.max_relay_log_size;
|
||||
# Check if max_relay_log_size can be accessed with and without @@ sign #
|
||||
#############################################################################
|
||||
|
||||
--Error ER_GLOBAL_VARIABLE
|
||||
SET max_relay_log_size = 6000;
|
||||
SELECT @@max_relay_log_size;
|
||||
--Error ER_PARSE_ERROR
|
||||
|
@ -52,3 +52,40 @@ char *fn_ext(const char *name)
|
||||
pos=strchr(gpos,FN_EXTCHAR);
|
||||
DBUG_RETURN((char*) (pos ? pos : strend(gpos)));
|
||||
} /* fn_ext */
|
||||
|
||||
|
||||
/*
|
||||
Return a pointer to the extension of the filename.
|
||||
|
||||
SYNOPSIS
|
||||
fn_ext()
|
||||
name Name of file
|
||||
|
||||
DESCRIPTION
|
||||
The extension is defined as everything after the last extension character
|
||||
(normally '.') after the directory name.
|
||||
|
||||
RETURN VALUES
|
||||
Pointer to to the extension character. If there isn't any extension,
|
||||
points at the end ASCII(0) of the filename.
|
||||
*/
|
||||
|
||||
char *fn_ext2(const char *name)
|
||||
{
|
||||
register const char *pos, *gpos;
|
||||
DBUG_ENTER("fn_ext");
|
||||
DBUG_PRINT("mfunkt",("name: '%s'",name));
|
||||
|
||||
#if defined(FN_DEVCHAR) || defined(BASKSLASH_MBTAIL)
|
||||
{
|
||||
char buff[FN_REFLEN];
|
||||
size_t res_length;
|
||||
gpos= name+ dirname_part(buff,(char*) name, &res_length);
|
||||
}
|
||||
#else
|
||||
if (!(gpos= strrchr(name, FN_LIBCHAR)))
|
||||
gpos= name;
|
||||
#endif
|
||||
pos=strrchr(gpos,FN_EXTCHAR);
|
||||
DBUG_RETURN((char*) (pos ? pos : strend(gpos)));
|
||||
} /* fn_ext */
|
||||
|
@ -4703,7 +4703,7 @@ bool MYSQL_BIN_LOG::append(Log_event* ev)
|
||||
DBUG_PRINT("info",("max_size: %lu",max_size));
|
||||
if (flush_and_sync(0))
|
||||
goto err;
|
||||
if ((uint) my_b_append_tell(&log_file) > max_size)
|
||||
if (my_b_append_tell(&log_file) > max_size)
|
||||
error= new_file_without_locking();
|
||||
err:
|
||||
mysql_mutex_unlock(&LOCK_log);
|
||||
@ -4734,7 +4734,7 @@ bool MYSQL_BIN_LOG::appendv(const char* buf, uint len,...)
|
||||
DBUG_PRINT("info",("max_size: %lu",max_size));
|
||||
if (flush_and_sync(0))
|
||||
goto err;
|
||||
if ((uint) my_b_append_tell(&log_file) > max_size)
|
||||
if (my_b_append_tell(&log_file) > max_size)
|
||||
error= new_file_without_locking();
|
||||
err:
|
||||
if (!error)
|
||||
|
@ -502,11 +502,8 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
|
||||
The max size before rotation (usable only if log_type == LOG_BIN: binary
|
||||
logs and relay logs).
|
||||
For a binlog, max_size should be max_binlog_size.
|
||||
For a relay log, it should be max_relay_log_size if this is non-zero,
|
||||
max_binlog_size otherwise.
|
||||
max_size is set in init(), and dynamically changed (when one does SET
|
||||
GLOBAL MAX_BINLOG_SIZE|MAX_RELAY_LOG_SIZE) by fix_max_binlog_size and
|
||||
fix_max_relay_log_size).
|
||||
GLOBAL MAX_BINLOG_SIZE|MAX_RELAY_LOG_SIZE) from sys_vars.cc
|
||||
*/
|
||||
ulong max_size;
|
||||
// current file sequence number for load data infile binary logging
|
||||
|
@ -906,9 +906,9 @@ int Log_event::do_update_pos(Relay_log_info *rli)
|
||||
Log_event::enum_skip_reason
|
||||
Log_event::do_shall_skip(Relay_log_info *rli)
|
||||
{
|
||||
DBUG_PRINT("info", ("ev->server_id=%lu, ::server_id=%lu,"
|
||||
" rli->replicate_same_server_id=%d,"
|
||||
" rli->slave_skip_counter=%d",
|
||||
DBUG_PRINT("info", ("ev->server_id: %lu, ::server_id: %lu,"
|
||||
" rli->replicate_same_server_id: %d,"
|
||||
" rli->slave_skip_counter: %lu",
|
||||
(ulong) server_id, (ulong) ::server_id,
|
||||
rli->replicate_same_server_id,
|
||||
rli->slave_skip_counter));
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "des_key_file.h" // load_des_key_file
|
||||
#include "sql_manager.h" // stop_handle_manager, start_handle_manager
|
||||
#include "sql_expression_cache.h" // subquery_cache_miss, subquery_cache_hit
|
||||
#include "sys_vars_shared.h"
|
||||
|
||||
#include <m_ctype.h>
|
||||
#include <my_dir.h>
|
||||
@ -469,7 +470,7 @@ ulong back_log, connect_timeout, concurrency, server_id;
|
||||
ulong table_cache_size, table_def_size;
|
||||
ulong what_to_log;
|
||||
ulong slow_launch_time, slave_open_temp_tables;
|
||||
ulong open_files_limit, max_binlog_size, max_relay_log_size;
|
||||
ulong open_files_limit, max_binlog_size;
|
||||
ulong slave_trans_retries;
|
||||
uint slave_net_timeout;
|
||||
ulong slave_exec_mode_options;
|
||||
@ -8017,8 +8018,27 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
|
||||
if (!max_long_data_size_used)
|
||||
max_long_data_size= global_system_variables.max_allowed_packet;
|
||||
|
||||
/* Rember if max_user_connections was 0 at startup */
|
||||
/* Remember if max_user_connections was 0 at startup */
|
||||
max_user_connections_checking= global_system_variables.max_user_connections != 0;
|
||||
|
||||
{
|
||||
sys_var *max_relay_log_size_var, *max_binlog_size_var;
|
||||
/* If max_relay_log_size is 0, then set it to max_binlog_size */
|
||||
if (!global_system_variables.max_relay_log_size)
|
||||
global_system_variables.max_relay_log_size= max_binlog_size;
|
||||
|
||||
/*
|
||||
Fix so that DEFAULT and limit checking works with max_relay_log_size
|
||||
(Yes, this is a hack, but it's required as the definition of
|
||||
max_relay_log_size allows it to be set to 0).
|
||||
*/
|
||||
max_relay_log_size_var= intern_find_sys_var("max_relay_log_size", 0);
|
||||
max_binlog_size_var= intern_find_sys_var("max_binlog_size", 0);
|
||||
max_relay_log_size_var->option.min_value=
|
||||
max_binlog_size_var->option.min_value;
|
||||
max_relay_log_size_var->option.def_value=
|
||||
max_binlog_size_var->option.def_value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ extern ulong max_prepared_stmt_count, prepared_stmt_count;
|
||||
extern ulong open_files_limit;
|
||||
extern ulonglong binlog_cache_size, binlog_stmt_cache_size;
|
||||
extern ulonglong max_binlog_cache_size, max_binlog_stmt_cache_size;
|
||||
extern ulong max_binlog_size, max_relay_log_size;
|
||||
extern ulong max_binlog_size;
|
||||
extern ulong slave_max_allowed_packet;
|
||||
extern ulong opt_binlog_rows_event_max_size;
|
||||
extern ulong rpl_recovery_rank, thread_cache_size;
|
||||
|
@ -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)
|
||||
{
|
||||
uint errors;
|
||||
size_t res_length;
|
||||
|
||||
*p++= separator;
|
||||
p= strmake(res_file_name, 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;
|
||||
|
||||
/* 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);
|
||||
|
@ -169,7 +169,7 @@ public:
|
||||
bool check_master_connection_name(LEX_STRING *name);
|
||||
void create_signed_file_name(char *res_file_name, uint length,
|
||||
const char *info_file,
|
||||
char separator,
|
||||
bool append,
|
||||
LEX_STRING *suffix);
|
||||
|
||||
uchar *get_key_master_info(Master_info *mi, size_t *length,
|
||||
|
@ -69,6 +69,7 @@ Relay_log_info::Relay_log_info(bool is_slave_recovery)
|
||||
group_relay_log_name[0]= event_relay_log_name[0]=
|
||||
group_master_log_name[0]= 0;
|
||||
until_log_name[0]= ign_master_log_name_end[0]= 0;
|
||||
max_relay_log_size= global_system_variables.max_relay_log_size;
|
||||
bzero((char*) &info_file, sizeof(info_file));
|
||||
bzero((char*) &cache_buf, sizeof(cache_buf));
|
||||
cached_charset_invalidate();
|
||||
@ -149,15 +150,6 @@ int init_relay_log_info(Relay_log_info* rli,
|
||||
event, in flush_master_info(mi, 1, ?).
|
||||
*/
|
||||
|
||||
/*
|
||||
For the maximum log size, we choose max_relay_log_size if it is
|
||||
non-zero, max_binlog_size otherwise. If later the user does SET
|
||||
GLOBAL on one of these variables, fix_max_binlog_size and
|
||||
fix_max_relay_log_size will reconsider the choice (for example
|
||||
if the user changes max_relay_log_size to zero, we have to
|
||||
switch to using max_binlog_size for the relay log) and update
|
||||
rli->relay_log.max_size (and mysql_bin_log.max_size).
|
||||
*/
|
||||
{
|
||||
/* Reports an error and returns, if the --relay-log's path
|
||||
is a directory.*/
|
||||
@ -212,7 +204,7 @@ a file name for --relay-log-index option", opt_relaylog_index_name);
|
||||
char *buf_relaylog_index_name= opt_relaylog_index_name;
|
||||
|
||||
create_signed_file_name(buf_relay_logname, sizeof(buf_relay_logname),
|
||||
ln, '-', &mi->connection_name);
|
||||
ln, 1, &mi->connection_name);
|
||||
ln= buf_relay_logname;
|
||||
|
||||
if (opt_relaylog_index_name)
|
||||
@ -220,7 +212,7 @@ a file name for --relay-log-index option", opt_relaylog_index_name);
|
||||
buf_relaylog_index_name= buf_relaylog_index_name_buff;
|
||||
create_signed_file_name(buf_relaylog_index_name_buff,
|
||||
sizeof(buf_relaylog_index_name_buff),
|
||||
opt_relaylog_index_name, '-',
|
||||
opt_relaylog_index_name, 0,
|
||||
&mi->connection_name);
|
||||
}
|
||||
|
||||
@ -232,8 +224,7 @@ a file name for --relay-log-index option", opt_relaylog_index_name);
|
||||
*/
|
||||
if (rli->relay_log.open_index_file(buf_relaylog_index_name, ln, TRUE) ||
|
||||
rli->relay_log.open(ln, LOG_BIN, 0, SEQ_READ_APPEND,
|
||||
(max_relay_log_size ? max_relay_log_size :
|
||||
max_binlog_size), 1, TRUE))
|
||||
mi->rli.max_relay_log_size, 1, TRUE))
|
||||
{
|
||||
mysql_mutex_unlock(&rli->data_lock);
|
||||
sql_print_error("Failed when trying to open logs for '%s' in init_relay_log_info(). Error: %M", ln, my_errno);
|
||||
|
@ -229,9 +229,10 @@ public:
|
||||
skipping one or more events in the master log that have caused
|
||||
errors, and have been manually applied by DBA already.
|
||||
*/
|
||||
volatile uint slave_skip_counter; /* Must be uint */
|
||||
volatile ulong slave_skip_counter; /* Must be ulong */
|
||||
volatile ulong abort_pos_wait; /* Incremented on change master */
|
||||
volatile ulong slave_run_id; /* Incremented on slave start */
|
||||
ulong max_relay_log_size;
|
||||
mysql_mutex_t log_space_lock;
|
||||
mysql_cond_t log_space_cond;
|
||||
THD * sql_thd;
|
||||
|
@ -68,13 +68,14 @@ public:
|
||||
enum binlog_status_enum { VARIABLE_NOT_IN_BINLOG,
|
||||
SESSION_VARIABLE_IN_BINLOG } binlog_status;
|
||||
|
||||
my_option option; ///< min, max, default values are stored here
|
||||
|
||||
protected:
|
||||
typedef bool (*on_check_function)(sys_var *self, THD *thd, set_var *var);
|
||||
typedef bool (*on_update_function)(sys_var *self, THD *thd, enum_var_type type);
|
||||
|
||||
int flags; ///< or'ed flag_enum values
|
||||
const SHOW_TYPE show_val_type; ///< what value_ptr() returns for sql_show.cc
|
||||
my_option option; ///< min, max, default values are stored here
|
||||
PolyLock *guard; ///< *second* lock that protects the variable
|
||||
ptrdiff_t offset; ///< offset to the value from global_system_variables
|
||||
on_check_function on_check;
|
||||
|
@ -534,10 +534,11 @@ typedef struct system_variables
|
||||
*/
|
||||
my_thread_id pseudo_thread_id;
|
||||
/**
|
||||
Place holder to store sql_slave_skip_counter in sys_var.cc during
|
||||
Place holders to store Multi-source variables in sys_var.cc during
|
||||
update and show of variables.
|
||||
*/
|
||||
uint slave_skip_counter;
|
||||
ulong slave_skip_counter;
|
||||
ulong max_relay_log_size;
|
||||
|
||||
my_bool low_priority_updates;
|
||||
my_bool query_cache_wlock_invalidate;
|
||||
|
@ -1308,10 +1308,10 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
|
||||
|
||||
create_signed_file_name(master_info_file_tmp,
|
||||
sizeof(master_info_file_tmp),
|
||||
master_info_file, '.', &mi->connection_name);
|
||||
master_info_file, 0, &mi->connection_name);
|
||||
create_signed_file_name(relay_log_info_file_tmp,
|
||||
sizeof(relay_log_info_file_tmp),
|
||||
relay_log_info_file, '.', &mi->connection_name);
|
||||
relay_log_info_file, 0, &mi->connection_name);
|
||||
|
||||
if (check_access(thd, SUPER_ACL, any_db, NULL, NULL, 0, 0))
|
||||
DBUG_RETURN(1);
|
||||
@ -1557,10 +1557,10 @@ int reset_slave(THD *thd, Master_info* mi)
|
||||
// and delete these two files
|
||||
create_signed_file_name(master_info_file_tmp,
|
||||
sizeof(master_info_file_tmp),
|
||||
master_info_file, '.', &mi->connection_name);
|
||||
master_info_file, 0, &mi->connection_name);
|
||||
create_signed_file_name(relay_log_info_file_tmp,
|
||||
sizeof(relay_log_info_file_tmp),
|
||||
relay_log_info_file, '.', &mi->connection_name);
|
||||
relay_log_info_file, 0, &mi->connection_name);
|
||||
|
||||
fn_format(fname, master_info_file_tmp, mysql_data_home, "", 4+32);
|
||||
if (mysql_file_stat(key_file_master_info, fname, &stat_area, MYF(0)) &&
|
||||
@ -1697,10 +1697,10 @@ bool change_master(THD* thd, Master_info* mi)
|
||||
|
||||
create_signed_file_name(master_info_file_tmp,
|
||||
sizeof(master_info_file_tmp),
|
||||
master_info_file, '.', &mi->connection_name);
|
||||
master_info_file, 0, &mi->connection_name);
|
||||
create_signed_file_name(relay_log_info_file_tmp,
|
||||
sizeof(relay_log_info_file_tmp),
|
||||
relay_log_info_file, '.', &mi->connection_name);
|
||||
relay_log_info_file, 0, &mi->connection_name);
|
||||
|
||||
/* if new Master_info doesn't exists, add it */
|
||||
if (!master_info_index->get_master_info(&mi->connection_name,
|
||||
|
@ -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 "
|
||||
|
@ -1954,24 +1954,34 @@ public:
|
||||
like sql_slave_skip_counter are GLOBAL.
|
||||
*/
|
||||
|
||||
class Sys_var_multi_source_uint :public Sys_var_uint
|
||||
class Sys_var_multi_source_ulong;
|
||||
class Master_info;
|
||||
|
||||
typedef bool (*on_multi_source_update_function)(sys_var *self, THD *thd,
|
||||
Master_info *mi);
|
||||
bool update_multi_source_variable(sys_var *self,
|
||||
THD *thd, enum_var_type type);
|
||||
|
||||
|
||||
class Sys_var_multi_source_ulong :public Sys_var_ulong
|
||||
{
|
||||
ptrdiff_t master_info_offset;
|
||||
on_multi_source_update_function update_multi_source_variable_func;
|
||||
public:
|
||||
Sys_var_multi_source_uint(const char *name_arg,
|
||||
const char *comment, int flag_args,
|
||||
ptrdiff_t off, size_t size,
|
||||
ptrdiff_t master_info_offset_arg,
|
||||
uint min_val, uint max_val, uint def_val,
|
||||
uint block_size,
|
||||
on_update_function on_update_func)
|
||||
:Sys_var_uint(name_arg, comment, flag_args, off, size,
|
||||
NO_CMD_LINE, min_val, max_val, def_val, block_size,
|
||||
0, VARIABLE_NOT_IN_BINLOG, 0, on_update_func),
|
||||
master_info_offset(master_info_offset_arg)
|
||||
Sys_var_multi_source_ulong(const char *name_arg,
|
||||
const char *comment, int flag_args,
|
||||
ptrdiff_t off, size_t size,
|
||||
CMD_LINE getopt,
|
||||
ptrdiff_t master_info_offset_arg,
|
||||
uint min_val, uint max_val, uint def_val,
|
||||
uint block_size,
|
||||
on_multi_source_update_function on_update_func)
|
||||
:Sys_var_ulong(name_arg, comment, flag_args, off, size,
|
||||
getopt, min_val, max_val, def_val, block_size,
|
||||
0, VARIABLE_NOT_IN_BINLOG, 0, update_multi_source_variable),
|
||||
master_info_offset(master_info_offset_arg),
|
||||
update_multi_source_variable_func(on_update_func)
|
||||
{
|
||||
/* No global storage of variables. Cause a crash if we try an update */
|
||||
option.value= (uchar**)1;
|
||||
}
|
||||
bool session_update(THD *thd, set_var *var)
|
||||
{
|
||||
@ -2001,6 +2011,10 @@ public:
|
||||
return session_value_ptr(thd, base);
|
||||
}
|
||||
uint get_master_info_uint_value(THD *thd, ptrdiff_t offset);
|
||||
bool update_variable(THD *thd, Master_info *mi)
|
||||
{
|
||||
return update_multi_source_variable_func(this, thd, mi);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user