Commit 05b1de99 authored by Elena Stepanova's avatar Elena Stepanova

More tests and test cleanup for MDEV-253 (Multi-source replication)

parent 1def7017
......@@ -87,6 +87,10 @@ show all slaves status;
Connection_name Slave_SQL_State 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 Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period
Slave has read all relay log; waiting for the slave I/O thread to update it 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 0 1073741824 6 0 60.000
MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it 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 0 1073741824 6 0 60.000
include/wait_for_slave_to_start.inc
set default_master_connection = 'MASTER 2.2';
include/wait_for_slave_to_start.inc
set default_master_connection = '';
show all slaves status;
Connection_name Slave_SQL_State 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 Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period
Slave has read all relay log; waiting for the slave I/O thread to update it 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 0 1073741824 6 0 60.000
......@@ -106,10 +110,6 @@ relay.bin.info
MASTER 2.2
# EOF
#
stop slave;
include/wait_for_slave_to_stop.inc
set default_master_connection = 'MASTER 2.2';
stop slave;
include/wait_for_slave_to_stop.inc
reset slave all;
reset slave '' all;
include/reset_master_slave.inc
include/reset_master_slave.inc
include/reset_master_slave.inc
......@@ -56,6 +56,12 @@ start slave 'MASTER 2.2';
set default_master_connection = 'MASTER 2.2';
--source include/wait_for_slave_to_start.inc
--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2)
--save_master_pos
--connection slave
--sync_with_master 0,'MASTER 2.2'
# Check the files
--echo #
......@@ -102,6 +108,12 @@ master_user='root';
start slave;
--source include/wait_for_slave_to_start.inc
--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1)
--save_master_pos
--connection slave
--sync_with_master
# Check the files
--echo #
......@@ -115,7 +127,6 @@ start slave;
--echo # EOF
--echo #
--sleep 5
--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
show all slaves status;
......@@ -127,6 +138,10 @@ restart
EOF
--shutdown_server 60
--source include/wait_until_connected_again.inc
--source include/wait_for_slave_to_start.inc
set default_master_connection = 'MASTER 2.2';
--source include/wait_for_slave_to_start.inc
set default_master_connection = '';
--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
show all slaves status;
......@@ -148,13 +163,14 @@ show all slaves status;
# Cleanup
stop slave;
--source include/wait_for_slave_to_stop.inc
--source reset_master_slave.inc
--disconnect slave
set default_master_connection = 'MASTER 2.2';
stop slave;
--source include/wait_for_slave_to_stop.inc
reset slave all;
reset slave '' all;
--connection master1
--source reset_master_slave.inc
--disconnect master1
--connection master2
--source reset_master_slave.inc
--disconnect master2
--disconnect slave
change master 'master1' to
master_port=MYPORT_1,
master_host='127.0.0.1',
master_user='root';
start slave 'master1';
set default_master_connection = 'master1';
include/wait_for_slave_to_start.inc
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
Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 mysqld-relay-bin-master1.000002 572 master-bin.000001 Yes Yes 0 0 286 876 None 0 No 0 No 0 0 1
show slave 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
Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 mysqld-relay-bin-master1.000002 572 master-bin.000001 Yes Yes 0 0 286 876 None 0 No 0 No 0 0 1
show all slaves status;
Connection_name Slave_SQL_State 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 Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period
master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 mysqld-relay-bin-master1.000002 572 master-bin.000001 Yes Yes 0 0 286 876 None 0 No 0 No 0 0 1 0 1073741824 6 0 60.000
drop database if exists db1;
create database db1;
use db1;
create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM;
insert into t1 (f1) values ('one'),('two');
select * from db1.t1;
i f1
1 one
2 two
# List of relay log files in the datadir
mysqld-relay-bin-master1.000001
mysqld-relay-bin-master1.000002
mysqld-relay-bin-master1.index
show relaylog events;
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-relay-bin-master1.000001 4 Format_desc 3 246 Server ver: 10.0.0-MariaDB-debug-log, Binlog ver: 4
mysqld-relay-bin-master1.000001 246 Rotate 3 304 mysqld-relay-bin-master1.000002;pos=4
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 ver: 10.0.0-MariaDB-debug-log, Binlog ver: 4
mysqld-relay-bin-master1.000002 246 Rotate 1 0 master-bin.000001;pos=4
mysqld-relay-bin-master1.000002 290 Format_desc 1 246 Server ver: 10.0.0-MariaDB-debug-log, Binlog ver: 4
mysqld-relay-bin-master1.000002 532 Binlog_checkpoint 1 286 master-bin.000001
mysqld-relay-bin-master1.000002 572 Query 1 375 drop database if exists db1
mysqld-relay-bin-master1.000002 661 Query 1 456 create database db1
mysqld-relay-bin-master1.000002 742 Query 1 609 use `db1`; create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM
mysqld-relay-bin-master1.000002 895 Query 1 676 BEGIN
mysqld-relay-bin-master1.000002 962 Intvar 1 704 INSERT_ID=1
mysqld-relay-bin-master1.000002 990 Query 1 808 use `db1`; insert into t1 (f1) values ('one'),('two')
mysqld-relay-bin-master1.000002 1094 Query 1 876 COMMIT
change master 'master1' to
master_port=MYPORT_2,
master_host='127.0.0.1',
master_user='root';
ERROR HY000: This operation cannot be performed as you have a running slave 'master1'; run STOP SLAVE 'master1' first
change master to
master_port=MYPORT_2,
master_host='127.0.0.1',
master_user='root';
ERROR HY000: This operation cannot be performed as you have a running slave 'master1'; run STOP SLAVE 'master1' first
change master 'master2' to
master_port=MYPORT_1,
master_host='127.0.0.1',
master_user='root';
ERROR HY000: Connection 'master2' conflicts with existing connection 'master1'
set default_master_connection = '';
change master to
master_port=MYPORT_2,
master_host='127.0.0.1',
master_user='root';
start slave;
include/wait_for_slave_to_start.inc
show all slaves status;
Connection_name Slave_SQL_State 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 Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period
Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 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 2 0 1073741824 6 0 60.000
master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 876 mysqld-relay-bin-master1.000002 1162 master-bin.000001 Yes Yes 0 0 876 1466 None 0 No 0 No 0 0 1 0 1073741824 13 0 60.000
insert into t1 (f1) values ('three');
drop database if exists db2;
create database db2;
use db2;
create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB;
begin;
insert into t1 (f1) values (1),(2);
select * from db1.t1;
i f1
1 one
2 two
3 three
select * from db2.t1;
pk f1
commit;
select * from db2.t1;
pk f1
1 1
2 2
flush logs;
purge binary logs to 'master-bin.000002';
show binary logs;
Log_name File_size
master-bin.000002 326
insert into t1 (f1) values ('four');
create table db1.t3 (f1 int) engine=InnoDB;
show all slaves status;
Connection_name Slave_SQL_State 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 Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period
Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 809 mysqld-relay-bin.000002 1095 master-bin.000001 Yes Yes 0 0 809 1391 None 0 No 0 No 0 0 2 0 1073741824 13 0 60.000
master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000002 690 mysqld-relay-bin-master1.000004 976 master-bin.000002 Yes Yes 0 0 690 1324 None 0 No 0 No 0 0 1 0 1073741824 31 0 60.000
select * from db1.t1;
i f1
1 one
2 two
3 three
4 four
show relaylog events;
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-relay-bin.000001 4 Format_desc 3 246 Server ver: 10.0.0-MariaDB-debug-log, Binlog ver: 4
mysqld-relay-bin.000001 246 Rotate 3 296 mysqld-relay-bin.000002;pos=4
show relaylog events in 'mysqld-relay-bin.000002';
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-relay-bin.000002 4 Format_desc 3 246 Server ver: 10.0.0-MariaDB-debug-log, Binlog ver: 4
mysqld-relay-bin.000002 246 Rotate 2 0 master-bin.000001;pos=4
mysqld-relay-bin.000002 290 Format_desc 2 246 Server ver: 10.0.0-MariaDB-debug-log, Binlog ver: 4
mysqld-relay-bin.000002 532 Binlog_checkpoint 2 286 master-bin.000001
mysqld-relay-bin.000002 572 Query 2 375 drop database if exists db2
mysqld-relay-bin.000002 661 Query 2 456 create database db2
mysqld-relay-bin.000002 742 Query 2 591 use `db2`; create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB
mysqld-relay-bin.000002 877 Query 2 658 BEGIN
mysqld-relay-bin.000002 944 Intvar 2 686 INSERT_ID=1
mysqld-relay-bin.000002 972 Query 2 782 use `db2`; insert into t1 (f1) values (1),(2)
mysqld-relay-bin.000002 1068 Xid 2 809 COMMIT /* xid=25 */
stop slave io_thread;
show status like 'Slave_running';
Variable_name Value
Slave_running OFF
set default_master_connection = 'master1';
show status like 'Slave_running';
Variable_name Value
Slave_running ON
drop database db1;
drop database db2;
include/reset_master_slave.inc
drop database db1;
include/reset_master_slave.inc
drop database db2;
include/reset_master_slave.inc
--source include/have_innodb.inc
--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
# Start replication from the first master
--replace_result $SERVER_MYPORT_1 MYPORT_1
eval change master 'master1' to
master_port=$SERVER_MYPORT_1,
master_host='127.0.0.1',
master_user='root';
start slave 'master1';
set default_master_connection = 'master1';
--source include/wait_for_slave_to_start.inc
--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1)
--save_master_pos
--connection slave
--sync_with_master 0,'master1'
# each of the 3 commands should produce
# 'master1' status
--replace_result $SERVER_MYPORT_1 MYPORT_1
show slave 'master1' status;
--replace_result $SERVER_MYPORT_1 MYPORT_1
show slave status;
--replace_result $SERVER_MYPORT_1 MYPORT_1
show all slaves status;
# Check that replication actually works
--connection master1
--disable_warnings
drop database if exists db1;
--enable_warnings
create database db1;
use db1;
create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM;
insert into t1 (f1) values ('one'),('two');
--save_master_pos
--connection slave
--sync_with_master 0,'master1'
--sorted_result
select * from db1.t1;
--let $datadir = `SELECT @@datadir`
--echo # List of relay log files in the datadir
--list_files $datadir mysqld-relay-bin-master1.*
# Check that relay logs are recognizable
show relaylog events;
show relaylog events in 'mysqld-relay-bin-master1.000002';
# Try to configure connection with the same name again,
# should get an error because the slave is running
--replace_result $SERVER_MYPORT_2 MYPORT_2
--error ER_SLAVE_MUST_STOP
eval change master 'master1' to
master_port=$SERVER_MYPORT_2,
master_host='127.0.0.1',
master_user='root';
# Try to configure using the default connection name
# (which is 'master1' at the moment),
# again, should get an error
--replace_result $SERVER_MYPORT_2 MYPORT_2
--error ER_SLAVE_MUST_STOP
eval change master to
master_port=$SERVER_MYPORT_2,
master_host='127.0.0.1',
master_user='root';
# Try to configure a connection with the same master
# using a different name, should get a conflict
--replace_result $SERVER_MYPORT_1 MYPORT_1
--error ER_CONNECTION_ALREADY_EXISTS
eval change master 'master2' to
master_port=$SERVER_MYPORT_1,
master_host='127.0.0.1',
master_user='root';
# Set up a proper 'default' connection to master2
set default_master_connection = '';
--replace_result $SERVER_MYPORT_2 MYPORT_2
eval change master to
master_port=$SERVER_MYPORT_2,
master_host='127.0.0.1',
master_user='root';
start slave;
--source include/wait_for_slave_to_start.inc
# See both connections in the same status output
--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
show all slaves status;
# Check that replication from two servers actually works
--connection master1
insert into t1 (f1) values ('three');
--save_master_pos
--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2)
--disable_warnings
drop database if exists db2;
--enable_warnings
create database db2;
use db2;
create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB;
begin;
insert into t1 (f1) values (1),(2);
--connection slave
--sync_with_master 0,'master1'
--connection master2
--save_master_pos
--connection slave
--sync_with_master 0
--sorted_result
select * from db1.t1;
select * from db2.t1;
--connection master2
commit;
--save_master_pos
--connection slave
--sync_with_master 0
--sorted_result
select * from db2.t1;
# Flush and purge logs on one master,
# make sure slaves don't get confused
--connection master1
flush logs;
--save_master_pos
--connection slave
--sync_with_master 0, 'master1'
--connection master1
purge binary logs to 'master-bin.000002';
show binary logs;
insert into t1 (f1) values ('four');
create table db1.t3 (f1 int) engine=InnoDB;
--save_master_pos
--connection slave
--sync_with_master 0,'master1'
--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2
show all slaves status;
--sorted_result
select * from db1.t1;
# This should show relay log events for the default master
# (the one with the empty name)
show relaylog events;
show relaylog events in 'mysqld-relay-bin.000002';
# Make sure we don't lose control over replication connections
# after reconnecting to the slave
--disconnect slave
--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
stop slave io_thread;
show status like 'Slave_running';
set default_master_connection = 'master1';
show status like 'Slave_running';
# Cleanup
drop database db1;
drop database db2;
--source reset_master_slave.inc
--disconnect slave
--connection master1
drop database db1;
--source reset_master_slave.inc
--disconnect master1
--connection master2
drop database db2;
--source reset_master_slave.inc
--disconnect master2
......@@ -23,7 +23,5 @@ Log_name Pos Event_type Server_id End_log_pos Info
mysqld-relay-bin-master1.000001 4 Format_desc 3 246 Server version
mysqld-relay-bin-master1.000001 246 Rotate 3 304 mysqld-relay-bin-master1.000002;pos=4
drop table t1;
stop slave;
include/wait_for_slave_to_stop.inc
reset slave 'master1' all;
reset master;
include/reset_master_slave.inc
include/reset_master_slave.inc
......@@ -39,14 +39,11 @@ drop table t1;
--connection slave
--sync_with_master 0,'master1'
stop slave;
--source include/wait_for_slave_to_stop.inc
reset slave 'master1' all;
--source reset_master_slave.inc
--disconnect slave
--connection master1
reset master;
--source reset_master_slave.inc
--disconnect master1
#
# The include file runs RESET ALL for every replication connection
# currently present in SHOW FULL SLAVE STATUS output on the server,
# and also runs RESET MASTER on the same server.
#
--let $include_filename= reset_master_slave.inc
--source include/begin_include_file.inc
--disable_query_log
--disable_result_log
--disable_warnings
--let $default_master = `SELECT @@default_master_connection`
--let $con_name = query_get_value(show all slaves status, Connection_name, 1)
while ($con_name != 'No such row')
{
eval set default_master_connection = '$con_name';
stop slave;
--source include/wait_for_slave_to_stop.inc
reset slave all;
--let $con_name = query_get_value(show all slaves status, Connection_name, 1)
}
--error 0,ER_FLUSH_MASTER_BINLOG_CLOSED
reset master;
eval set default_master_connection = '$default_master';
--source include/end_include_file.inc
......@@ -23,5 +23,6 @@ reset slave 'master1' all;
show slave 'master1' status;
ERROR HY000: There is no master connection 'master1'
drop table t1;
include/reset_master_slave.inc
drop table t1;
reset master;
include/reset_master_slave.inc
......@@ -51,11 +51,12 @@ show slave 'master1' status;
# Cleanup
drop table t1;
--source reset_master_slave.inc
--disconnect slave
--connection master1
drop table t1;
reset master;
--source reset_master_slave.inc
--disconnect master1
......
......@@ -72,4 +72,6 @@ show all slaves status;
Connection_name Slave_SQL_State 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 Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period
slave2 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin-slave2.000002 572 master-bin.000001 No No 0 0 286 875 None 0 No NULL No 0 0 2 0 1073741824 6 0 60.000
stop all slaves;
reset slave 'slave2' all;
include/reset_master_slave.inc
include/reset_master_slave.inc
include/reset_master_slave.inc
......@@ -59,4 +59,13 @@ stop all slaves;
#
# clean up
#
reset slave 'slave2' all;
--source reset_master_slave.inc
--disconnect slave
--connection master1
--source reset_master_slave.inc
--disconnect master1
--connection master2
--source reset_master_slave.inc
--disconnect master2
connect master1,127.0.0.1,root,,,$SERVER_MYPORT_1;
drop database if exists db;
create database db;
create table db.t1 (i int) engine=MyISAM;
connect master2,127.0.0.1,root,,,$SERVER_MYPORT_2;
drop database if exists db;
create database db;
create table db.t2 (i int) engine=MyISAM;
connect slave,127.0.0.1,root,,,$SERVER_MYPORT_3;
change master 'master1' to
master_port=MYPORT_1,
master_host='127.0.0.1',
......@@ -101,26 +98,16 @@ select @@global.max_relay_log_size;
start slave 'master2';
include/wait_for_slave_to_start.inc
set default_master_connection = '';
connection master2;
connection slave;
show tables in db;
Tables_in_db
t1
t2
drop database db;
set default_master_connection = 'master1';
stop slave;
include/wait_for_slave_to_stop.inc
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;
include/reset_master_slave.inc
drop database db;
disconnect master1;
connection master2;
include/reset_master_slave.inc
drop database db;
disconnect master2;
include/reset_master_slave.inc
......@@ -2,8 +2,6 @@
# Test of sql_slave_skip_counter and rpl_max_size
#
--enable_connect_log
# Create a schema and a table i
# on the 1st master
......@@ -28,7 +26,6 @@ create database db;
create table db.t2 (i int) engine=MyISAM;
--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
--disable_connect_log
# Start replication from the first master
......@@ -106,14 +103,11 @@ start slave 'master2';
--source include/wait_for_slave_to_start.inc
set default_master_connection = '';
--enable_connect_log
--connection master2
--save_master_pos
--connection slave
--disable_connect_log
--sync_with_master 0,'master2'
# If the skip_counter worked as expected, we should
......@@ -127,25 +121,21 @@ show tables in db;
# Cleanup
drop database db;
set default_master_connection = 'master1';
stop slave;
--source include/wait_for_slave_to_stop.inc
set default_master_connection = 'master2';
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
--source reset_master_slave.inc
--disconnect slave
--connection master1
drop database db;
--source reset_master_slave.inc
--disconnect master1
--connection master2
drop database db;
--source reset_master_slave.inc
--disconnect master2
call mtr.add_suppression("Connection 'master1' already exists");
change master 'master1' to
master_port=MYPORT_1,
master_host='127.0.0.1',
master_user='root',
master_heartbeat_period = 25;
start slave 'master1';
set default_master_connection = 'master1';
include/wait_for_slave_to_start.inc
set default_master_connection = '';
change master to
master_port=MYPORT_2,
master_host='127.0.0.1',
master_user='root',
master_heartbeat_period=35;
start slave;
include/wait_for_slave_to_start.inc
#
# Check how status works for the default connection, anonymous or named
#
# Slave_running and Slave_heartbeat_period should be local for a connection
#
set default_master_connection = '';
show status like 'Slave_running';
Variable_name Value
Slave_running ON
show status like 'Slave_heartbeat_period';
Variable_name Value
Slave_heartbeat_period 35.000
stop slave io_thread;
include/wait_for_slave_io_to_stop.inc
show status like 'Slave_running';
Variable_name Value
Slave_running OFF
set default_master_connection = 'master1';
show status like 'Slave_running';
Variable_name Value
Slave_running ON
show status like 'Slave_heartbeat_period';
Variable_name Value
Slave_heartbeat_period 25.000
#
# Slave_received_heartbeats should also be local
#
set default_master_connection = '';
stop slave sql_thread;
include/wait_for_slave_sql_to_stop.inc
change master to master_heartbeat_period=1;
show status like 'Slave_received_heartbeats';
Variable_name Value
Slave_received_heartbeats 0
start slave;
include/wait_for_slave_to_start.inc
show status like 'Slave_received_heartbeats';
Variable_name Value
Slave_received_heartbeats 2
stop slave;
include/wait_for_slave_to_stop.inc
set default_master_connection = 'master1';
show status like 'Slave_received_heartbeats';
Variable_name Value
Slave_received_heartbeats 0
stop slave;
include/wait_for_slave_to_stop.inc
change master to master_heartbeat_period=2;
start slave;
include/wait_for_slave_to_start.inc
show status like 'Slave_received_heartbeats';
Variable_name Value
Slave_received_heartbeats 1
#
# Slave_open_temp_tables should be global
#
set default_master_connection = '';
start slave;
include/wait_for_slave_to_start.inc
set binlog_format = statement;
create temporary table tmp1 (i int) engine=MyISAM;
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 1
set default_master_connection = 'master1';
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 1
set binlog_format = statement;
create temporary table tmp1 (i int) engine=MyISAM;
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 2
set default_master_connection = '';
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 2
include/reset_master_slave.inc
include/reset_master_slave.inc
include/reset_master_slave.inc
--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
call mtr.add_suppression("Connection 'master1' already exists");
# Start replication from the first master
--replace_result $SERVER_MYPORT_1 MYPORT_1
eval change master 'master1' to
master_port=$SERVER_MYPORT_1,
master_host='127.0.0.1',
master_user='root',
master_heartbeat_period = 25;
start slave 'master1';
set default_master_connection = 'master1';
--source include/wait_for_slave_to_start.inc
# Set up a proper 'default' connection to master2
set default_master_connection = '';
--replace_result $SERVER_MYPORT_2 MYPORT_2
eval change master to
master_port=$SERVER_MYPORT_2,
master_host='127.0.0.1',
master_user='root',
master_heartbeat_period=35;
start slave;
--source include/wait_for_slave_to_start.inc
--echo #
--echo # Check how status works for the default connection, anonymous or named
--echo #
--echo # Slave_running and Slave_heartbeat_period should be local for a connection
--echo #
set default_master_connection = '';
show status like 'Slave_running';
show status like 'Slave_heartbeat_period';
stop slave io_thread;
--source include/wait_for_slave_io_to_stop.inc
show status like 'Slave_running';
set default_master_connection = 'master1';
show status like 'Slave_running';
show status like 'Slave_heartbeat_period';
--echo #
--echo # Slave_received_heartbeats should also be local
--echo #
set default_master_connection = '';
stop slave sql_thread;
--source include/wait_for_slave_sql_to_stop.inc
change master to master_heartbeat_period=1;
show status like 'Slave_received_heartbeats';
start slave;
--source include/wait_for_slave_to_start.inc
--let $status_var = Slave_received_heartbeats
--let $status_var_value = 2
# The units are tens of seconds
--let $status_timeout = 30
--source include/wait_for_status_var.inc
show status like 'Slave_received_heartbeats';
stop slave;
--source include/wait_for_slave_to_stop.inc
set default_master_connection = 'master1';
show status like 'Slave_received_heartbeats';
stop slave;
--source include/wait_for_slave_to_stop.inc
change master to master_heartbeat_period=2;
start slave;
--source include/wait_for_slave_to_start.inc
--let $status_var = Slave_received_heartbeats
--let $status_var_value = 1
--let $status_timeout = 30
--source include/wait_for_status_var.inc
show status like 'Slave_received_heartbeats';
--echo #
--echo # Slave_open_temp_tables should be global
--echo #
set default_master_connection = '';
start slave;
--source include/wait_for_slave_to_start.inc
--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1)
set binlog_format = statement;
create temporary table tmp1 (i int) engine=MyISAM;
--save_master_pos
--connection slave
--sync_with_master 0,'master1'
show status like 'Slave_open_temp_tables';
set default_master_connection = 'master1';
show status like 'Slave_open_temp_tables';
--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2)
set binlog_format = statement;
create temporary table tmp1 (i int) engine=MyISAM;
--save_master_pos
--connection slave
--sync_with_master 0,''
show status like 'Slave_open_temp_tables';
set default_master_connection = '';
show status like 'Slave_open_temp_tables';
# Cleanup
--source reset_master_slave.inc
--disconnect slave
--connection master1
--source reset_master_slave.inc
--disconnect master1
--connection master2
--source reset_master_slave.inc
--disconnect master2
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