mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge branch '10.6' into 10.11
This commit is contained in:
@@ -85,5 +85,16 @@ SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHER
|
||||
--eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$MASTER_MYPORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1
|
||||
--source include/start_slave.inc
|
||||
|
||||
# Ensure master is ready to start sending new transactions. That is, because
|
||||
# the master does not have log_slave_updates, the slave's transactions of
|
||||
# repl_t are not binlogged, and its state is behind. If the master binlogs
|
||||
# any new transactions before the slaves connection is matured,
|
||||
# ER_GTID_POSITION_NOT_FOUND_IN_BINLOG2 can be reported to the slave
|
||||
# FIXME: We shouldn't need to do this, rather, the master should use
|
||||
# log-slave-updates and gtid-strict-mode
|
||||
--connection master
|
||||
--let $wait_condition= SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE State like '%Master has sent all binlog to slave%'
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--let $include_filename= rpl_change_master_demote.inc
|
||||
--source include/end_include_file.inc
|
||||
|
@@ -8,6 +8,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
|
||||
include/start_slave.inc
|
||||
connection master;
|
||||
"Test Case 1: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('')"
|
||||
include/wait_for_pattern_in_file.inc
|
||||
FOUND 1 /using_gtid\(1\), gtid\(\'\'\).*/ in mysqld.1.err
|
||||
connection slave;
|
||||
include/stop_slave.inc
|
||||
@@ -15,6 +16,7 @@ CHANGE MASTER TO MASTER_USE_GTID=no;
|
||||
include/start_slave.inc
|
||||
connection master;
|
||||
"Test Case 2: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(0), gtid('')"
|
||||
include/wait_for_pattern_in_file.inc
|
||||
FOUND 1 /using_gtid\(0\), gtid\(\'\'\).*/ in mysqld.1.err
|
||||
CREATE TABLE t (f INT) ENGINE=INNODB;
|
||||
INSERT INTO t VALUES(10);
|
||||
@@ -25,6 +27,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
|
||||
include/start_slave.inc
|
||||
connection master;
|
||||
"Test Case 3: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2')"
|
||||
include/wait_for_pattern_in_file.inc
|
||||
FOUND 1 /using_gtid\(1\), gtid\(\'0-1-2\'\).*/ in mysqld.1.err
|
||||
SET @@SESSION.gtid_domain_id=10;
|
||||
INSERT INTO t VALUES(20);
|
||||
@@ -35,6 +38,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
|
||||
include/start_slave.inc
|
||||
connection master;
|
||||
"Test Case 4: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2,10-1-1')"
|
||||
include/wait_for_pattern_in_file.inc
|
||||
FOUND 1 /using_gtid\(1\), gtid\(\'0-1-2,10-1-1\'\).*/ in mysqld.1.err
|
||||
"===== Clean up ====="
|
||||
connection slave;
|
||||
|
@@ -58,6 +58,7 @@ GTID_SLAVE_POS 0-2-3
|
||||
connection master;
|
||||
connection slave;
|
||||
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
|
||||
connection master;
|
||||
#
|
||||
# Test Case 2: If gtid_slave_pos is empty, gtid_binlog_pos will
|
||||
# completely overwrite it with MASTER_DEMOTE_TO_SLAVE=1.
|
||||
@@ -124,6 +125,7 @@ GTID_SLAVE_POS 0-2-5
|
||||
connection master;
|
||||
connection slave;
|
||||
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
|
||||
connection master;
|
||||
#
|
||||
# Test Case 3: Using a single domain id, if neither gtid_slave_pos nor
|
||||
# gtid_binlog_pos are empty, and gtid_binlog_pos is more recent, then
|
||||
@@ -183,6 +185,7 @@ GTID_SLAVE_POS 0-2-9
|
||||
connection master;
|
||||
connection slave;
|
||||
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
|
||||
connection master;
|
||||
#
|
||||
# Test Case 4: If gtid_slave_pos and gtid_binlog_pos are equivalent,
|
||||
# MASTER_DEMOTE_TO_SLAVE=1 will not change gtid_slave_pos.
|
||||
@@ -244,6 +247,7 @@ GTID_SLAVE_POS 0-2-13
|
||||
connection master;
|
||||
connection slave;
|
||||
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
|
||||
connection master;
|
||||
#
|
||||
# Test Case 5: If a new domain id is added into gtid_binlog_pos while
|
||||
# gtid_slave_pos already has a state, MASTER_DEMOTE_TO_SLAVE=1 will
|
||||
@@ -308,6 +312,7 @@ GTID_SLAVE_POS 0-2-17,1-1-2
|
||||
connection master;
|
||||
connection slave;
|
||||
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
|
||||
connection master;
|
||||
#
|
||||
# Test Case 6: If gtid_slave_pos has multiple GTID positions and
|
||||
# gtid_binlog_pos contains updates on existing domain ids, new
|
||||
@@ -390,6 +395,7 @@ GTID_SLAVE_POS 0-2-21,1-3-4,2-1-2,4-3-2
|
||||
connection master;
|
||||
connection slave;
|
||||
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
|
||||
connection master;
|
||||
#
|
||||
# Test Case 7: If MASTER_DEMOTE_TO_SLAVE=1 is combined with
|
||||
# IGNORE_DOMAIN_IDS such that gtid_binlog_pos has more recent GTIDs
|
||||
@@ -455,6 +461,7 @@ GTID_SLAVE_POS 0-2-24,1-3-4,2-1-3,3-1-2,4-3-2
|
||||
connection master;
|
||||
connection slave;
|
||||
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
|
||||
connection master;
|
||||
#
|
||||
# Test Case 8: If gtid_binlog_pos is more recent than gtid_slave_pos,
|
||||
# and MASTER_DEMOTE_TO_SLAVE=1 is combined with a later call to
|
||||
@@ -556,6 +563,7 @@ GTID_SLAVE_POS 0-2-29,1-3-4,2-1-3,3-1-2,4-3-2
|
||||
connection master;
|
||||
connection slave;
|
||||
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
|
||||
connection master;
|
||||
# Demote master to slave with the more recent gtid_slave_pos
|
||||
connection master;
|
||||
CHANGE MASTER TO master_host='127.0.0.1', master_port=SLAVE_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
|
||||
@@ -619,6 +627,7 @@ GTID_SLAVE_POS 0-2-32,1-3-4,2-1-3,3-1-2,4-3-2
|
||||
connection master;
|
||||
connection slave;
|
||||
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
|
||||
connection master;
|
||||
# Tag gtid_slave_pos now (before binlog updates) for later comparison
|
||||
connection master;
|
||||
# In domain 1, make gtid_slave_pos < gtid_binlog_pos
|
||||
|
@@ -1,5 +1,7 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
connection server_2;
|
||||
call mtr.add_suppression("Timeout waiting for reply of binlog");
|
||||
# Master server_1 and Slave server_2 initialization ...
|
||||
connection server_2;
|
||||
include/stop_slave.inc
|
||||
@@ -40,6 +42,8 @@ set @@global.rpl_semi_sync_master_enabled = 1;
|
||||
INSERT INTO t1(a) VALUES (2);
|
||||
include/save_master_gtid.inc
|
||||
connection server_1;
|
||||
include/stop_slave.inc
|
||||
include/start_slave.inc
|
||||
#
|
||||
# the successful sync is a required proof
|
||||
#
|
||||
|
@@ -70,6 +70,9 @@ include/stop_slave.inc
|
||||
# CHANGE MASTER TO MASTER_DELAY = 2*T
|
||||
include/start_slave.inc
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES ('Syncing slave', 5);
|
||||
connection slave;
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES (delay_on_slave(1), 6);
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
|
||||
|
@@ -38,8 +38,9 @@ connection master;
|
||||
include/rpl_start_server.inc [server_number=1]
|
||||
# Master has restarted successfully
|
||||
connection slave;
|
||||
include/wait_for_slave_io_to_start.inc
|
||||
include/wait_for_slave_sql_to_start.inc
|
||||
include/stop_slave_sql.inc
|
||||
include/stop_slave_io.inc
|
||||
include/start_slave.inc
|
||||
select * from ti;
|
||||
a
|
||||
1
|
||||
|
@@ -21,23 +21,23 @@ master-bin.000001 # Gtid 1 # GTID #-#-#
|
||||
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
|
||||
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 1
|
||||
master-bin.000001 # Table_map 1 # table_id: 4294967295 (test.t)
|
||||
master-bin.000001 # Write_rows_v1 1 # table_id: 4294967295 flags: STMT_END_F
|
||||
master-bin.000001 # Query 1 # COMMIT
|
||||
master-bin.000001 # Gtid 1 # GTID #-#-#
|
||||
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
|
||||
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 2
|
||||
master-bin.000001 # Table_map 1 # table_id: 4294967296 (test.t)
|
||||
master-bin.000001 # Write_rows_v1 1 # table_id: 4294967296 flags: STMT_END_F
|
||||
master-bin.000001 # Query 1 # COMMIT
|
||||
master-bin.000001 # Gtid 1 # GTID #-#-#
|
||||
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
|
||||
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 3
|
||||
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 2
|
||||
master-bin.000001 # Table_map 1 # table_id: 4294967297 (test.t)
|
||||
master-bin.000001 # Write_rows_v1 1 # table_id: 4294967297 flags: STMT_END_F
|
||||
master-bin.000001 # Query 1 # COMMIT
|
||||
master-bin.000001 # Gtid 1 # GTID #-#-#
|
||||
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
|
||||
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 3
|
||||
master-bin.000001 # Table_map 1 # table_id: 4294967298 (test.t)
|
||||
master-bin.000001 # Write_rows_v1 1 # table_id: 4294967298 flags: STMT_END_F
|
||||
master-bin.000001 # Query 1 # COMMIT
|
||||
connection slave;
|
||||
connection master;
|
||||
SET debug_dbug=@old_debug_dbug;
|
||||
|
@@ -6,7 +6,8 @@ CHANGE MASTER TO MASTER_USE_GTID=NO;
|
||||
include/start_slave.inc
|
||||
include/stop_slave.inc
|
||||
SET @save_dbug= @@GLOBAL.debug_dbug;
|
||||
SET @@global.debug_dbug="+d,pause_sql_thread_on_fde,negate_clock_diff_with_master";
|
||||
SET @@global.debug_dbug="+d,pause_sql_thread_on_relay_fde_after_trans";
|
||||
SET @@global.debug_dbug="+d,negate_clock_diff_with_master";
|
||||
include/start_slave.inc
|
||||
# Future events must be logged at least 2 seconds after
|
||||
# the slave starts
|
||||
@@ -18,11 +19,6 @@ insert into t1 values (1);
|
||||
# event in its relay log
|
||||
flush logs;
|
||||
connection slave;
|
||||
# Ignore FDEs that happen before the CREATE/INSERT commands
|
||||
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
|
||||
SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
|
||||
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
|
||||
SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
|
||||
# On the next FDE, the slave should have the master CREATE/INSERT events
|
||||
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
|
||||
select count(*)=1 from t1;
|
||||
|
@@ -7,7 +7,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
|
||||
call mtr.add_suppression("mysqld: Got an error reading communication packets");
|
||||
connection slave;
|
||||
set sql_log_bin=0;
|
||||
call mtr.add_suppression("Master server does not support semi-sync");
|
||||
call mtr.add_suppression("Semi-sync slave .* reply");
|
||||
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
|
||||
set sql_log_bin=1;
|
||||
@@ -28,7 +27,7 @@ set global rpl_semi_sync_slave_enabled= 0;
|
||||
# Main test of semi-sync replication start here
|
||||
#
|
||||
connection master;
|
||||
set global rpl_semi_sync_master_timeout= 60000;
|
||||
set global rpl_semi_sync_master_timeout= 2000;
|
||||
[ default state of semi-sync on master should be OFF ]
|
||||
show variables like 'rpl_semi_sync_master_enabled';
|
||||
Variable_name Value
|
||||
@@ -163,11 +162,15 @@ connection slave;
|
||||
# Test semi-sync master will switch OFF after one transaction
|
||||
# timeout waiting for slave reply.
|
||||
#
|
||||
connection master;
|
||||
show status like "Rpl_semi_sync_master_status";
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_status ON
|
||||
connection slave;
|
||||
include/stop_slave.inc
|
||||
connection master;
|
||||
include/kill_binlog_dump_threads.inc
|
||||
set global rpl_semi_sync_master_timeout= 5000;
|
||||
set global rpl_semi_sync_master_timeout= 2000;
|
||||
[ master status should be ON ]
|
||||
show status like 'Rpl_semi_sync_master_no_tx';
|
||||
Variable_name Value
|
||||
@@ -317,6 +320,8 @@ include/kill_binlog_dump_threads.inc
|
||||
connection slave;
|
||||
include/start_slave.inc
|
||||
connection master;
|
||||
connection slave;
|
||||
connection master;
|
||||
create table t1 (a int) engine = ENGINE_TYPE;
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (2), (3);
|
||||
@@ -359,6 +364,8 @@ show status like 'Rpl_semi_sync_slave_status';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_slave_status ON
|
||||
connection master;
|
||||
connection slave;
|
||||
connection master;
|
||||
[ master semi-sync should be ON ]
|
||||
show status like 'Rpl_semi_sync_master_clients';
|
||||
Variable_name Value
|
||||
|
@@ -8,7 +8,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
|
||||
call mtr.add_suppression("mysqld: Got an error reading communication packets");
|
||||
connection slave;
|
||||
set sql_log_bin=0;
|
||||
call mtr.add_suppression("Master server does not support semi-sync");
|
||||
call mtr.add_suppression("Semi-sync slave .* reply");
|
||||
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
|
||||
set sql_log_bin=1;
|
||||
@@ -29,7 +28,7 @@ set global rpl_semi_sync_slave_enabled= 0;
|
||||
# Main test of semi-sync replication start here
|
||||
#
|
||||
connection master;
|
||||
set global rpl_semi_sync_master_timeout= 60000;
|
||||
set global rpl_semi_sync_master_timeout= 2000;
|
||||
[ default state of semi-sync on master should be OFF ]
|
||||
show variables like 'rpl_semi_sync_master_enabled';
|
||||
Variable_name Value
|
||||
@@ -164,11 +163,15 @@ connection slave;
|
||||
# Test semi-sync master will switch OFF after one transaction
|
||||
# timeout waiting for slave reply.
|
||||
#
|
||||
connection master;
|
||||
show status like "Rpl_semi_sync_master_status";
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_status ON
|
||||
connection slave;
|
||||
include/stop_slave.inc
|
||||
connection master;
|
||||
include/kill_binlog_dump_threads.inc
|
||||
set global rpl_semi_sync_master_timeout= 5000;
|
||||
set global rpl_semi_sync_master_timeout= 2000;
|
||||
[ master status should be ON ]
|
||||
show status like 'Rpl_semi_sync_master_no_tx';
|
||||
Variable_name Value
|
||||
@@ -318,6 +321,8 @@ include/kill_binlog_dump_threads.inc
|
||||
connection slave;
|
||||
include/start_slave.inc
|
||||
connection master;
|
||||
connection slave;
|
||||
connection master;
|
||||
create table t1 (a int) engine = ENGINE_TYPE;
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (2), (3);
|
||||
@@ -360,6 +365,8 @@ show status like 'Rpl_semi_sync_slave_status';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_slave_status ON
|
||||
connection master;
|
||||
connection slave;
|
||||
connection master;
|
||||
[ master semi-sync should be ON ]
|
||||
show status like 'Rpl_semi_sync_master_clients';
|
||||
Variable_name Value
|
||||
|
@@ -8,7 +8,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
|
||||
call mtr.add_suppression("mysqld: Got an error reading communication packets");
|
||||
connection slave;
|
||||
set sql_log_bin=0;
|
||||
call mtr.add_suppression("Master server does not support semi-sync");
|
||||
call mtr.add_suppression("Semi-sync slave .* reply");
|
||||
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
|
||||
set sql_log_bin=1;
|
||||
@@ -29,7 +28,7 @@ set global rpl_semi_sync_slave_enabled= 0;
|
||||
# Main test of semi-sync replication start here
|
||||
#
|
||||
connection master;
|
||||
set global rpl_semi_sync_master_timeout= 60000;
|
||||
set global rpl_semi_sync_master_timeout= 2000;
|
||||
[ default state of semi-sync on master should be OFF ]
|
||||
show variables like 'rpl_semi_sync_master_enabled';
|
||||
Variable_name Value
|
||||
@@ -164,11 +163,15 @@ connection slave;
|
||||
# Test semi-sync master will switch OFF after one transaction
|
||||
# timeout waiting for slave reply.
|
||||
#
|
||||
connection master;
|
||||
show status like "Rpl_semi_sync_master_status";
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_status ON
|
||||
connection slave;
|
||||
include/stop_slave.inc
|
||||
connection master;
|
||||
include/kill_binlog_dump_threads.inc
|
||||
set global rpl_semi_sync_master_timeout= 5000;
|
||||
set global rpl_semi_sync_master_timeout= 2000;
|
||||
[ master status should be ON ]
|
||||
show status like 'Rpl_semi_sync_master_no_tx';
|
||||
Variable_name Value
|
||||
@@ -318,6 +321,8 @@ include/kill_binlog_dump_threads.inc
|
||||
connection slave;
|
||||
include/start_slave.inc
|
||||
connection master;
|
||||
connection slave;
|
||||
connection master;
|
||||
create table t1 (a int) engine = ENGINE_TYPE;
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (2), (3);
|
||||
@@ -360,6 +365,8 @@ show status like 'Rpl_semi_sync_slave_status';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_slave_status ON
|
||||
connection master;
|
||||
connection slave;
|
||||
connection master;
|
||||
[ master semi-sync should be ON ]
|
||||
show status like 'Rpl_semi_sync_master_clients';
|
||||
Variable_name Value
|
||||
|
@@ -7,7 +7,6 @@ call mtr.add_suppression("Read semi-sync reply");
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
|
||||
call mtr.add_suppression("mysqld: Got an error reading communication packets");
|
||||
connection slave;
|
||||
call mtr.add_suppression("Master server does not support semi-sync");
|
||||
call mtr.add_suppression("Semi-sync slave .* reply");
|
||||
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
|
||||
connection master;
|
||||
|
@@ -8,7 +8,6 @@ call mtr.add_suppression("Read semi-sync reply");
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
|
||||
call mtr.add_suppression("mysqld: Got an error reading communication packets");
|
||||
connection slave;
|
||||
call mtr.add_suppression("Master server does not support semi-sync");
|
||||
call mtr.add_suppression("Semi-sync slave .* reply");
|
||||
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
|
||||
connection master;
|
||||
|
@@ -5,6 +5,7 @@ include/stop_slave.inc
|
||||
connection server_1;
|
||||
RESET MASTER;
|
||||
SET @@global.max_binlog_size= 4096;
|
||||
set @@global.rpl_semi_sync_master_enabled = 1;
|
||||
connection server_2;
|
||||
RESET MASTER;
|
||||
SET @@global.max_binlog_size= 4096;
|
||||
@@ -14,7 +15,6 @@ CHANGE MASTER TO master_use_gtid= slave_pos;
|
||||
include/start_slave.inc
|
||||
connection server_1;
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
|
||||
set @@global.rpl_semi_sync_master_enabled = 1;
|
||||
set @@global.rpl_semi_sync_master_wait_point=AFTER_SYNC;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
|
||||
INSERT INTO t1 VALUES (1, 'dummy1');
|
||||
|
@@ -0,0 +1,48 @@
|
||||
include/rpl_init.inc [topology=1->2,1->3]
|
||||
connection server_1;
|
||||
set @old_enabled= @@global.rpl_semi_sync_master_enabled;
|
||||
set @old_timeout= @@global.rpl_semi_sync_master_timeout;
|
||||
set global rpl_semi_sync_master_enabled= 1;
|
||||
set global rpl_semi_sync_master_timeout= 500;
|
||||
connection server_2;
|
||||
include/stop_slave.inc
|
||||
set @old_enabled= @@global.rpl_semi_sync_slave_enabled;
|
||||
set @old_dbug= @@global.debug_dbug;
|
||||
set global rpl_semi_sync_slave_enabled= 1;
|
||||
set global debug_dbug="+d,simulate_delay_semisync_slave_reply";
|
||||
include/start_slave.inc
|
||||
connection server_3;
|
||||
include/stop_slave.inc
|
||||
set @old_enabled= @@global.rpl_semi_sync_slave_enabled;
|
||||
set global rpl_semi_sync_slave_enabled= 1;
|
||||
include/start_slave.inc
|
||||
# Ensure primary recognizes both replicas are semi-sync
|
||||
connection server_1;
|
||||
connection server_1;
|
||||
create table t1 (a int);
|
||||
connection server_2;
|
||||
# Verifying server_2 did not send ACK
|
||||
connection server_3;
|
||||
# Verifying server_3 did send ACK
|
||||
connection server_1;
|
||||
# Verifying master's semi-sync status is still ON (This failed pre-MDEV-32960 fixes)
|
||||
# Verifying rpl_semi_sync_master_yes_tx incremented
|
||||
#
|
||||
# Cleanup
|
||||
connection server_2;
|
||||
set global rpl_semi_sync_slave_enabled= @old_enabled;
|
||||
set global debug_dbug= @old_dbug;
|
||||
include/stop_slave.inc
|
||||
connection server_3;
|
||||
set global rpl_semi_sync_slave_enabled= @old_enabled;
|
||||
include/stop_slave.inc
|
||||
connection server_1;
|
||||
set global rpl_semi_sync_master_enabled= @old_enabled;
|
||||
set global rpl_semi_sync_master_timeout= @old_timeout;
|
||||
drop table t1;
|
||||
connection server_2;
|
||||
include/start_slave.inc
|
||||
connection server_3;
|
||||
include/start_slave.inc
|
||||
include/rpl_end.inc
|
||||
# End of rpl_semi_sync_no_missed_ack_after_add_slave.test
|
@@ -0,0 +1,35 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
call mtr.add_suppression("Replication event checksum verification failed");
|
||||
call mtr.add_suppression("could not queue event from master");
|
||||
#
|
||||
# Set up a semisync connection
|
||||
connection master;
|
||||
set @@global.rpl_semi_sync_master_enabled= ON;
|
||||
connection slave;
|
||||
stop slave io_thread;
|
||||
set @@global.rpl_semi_sync_slave_enabled= ON;
|
||||
set @old_dbug= @@global.debug_dbug;
|
||||
set @@global.debug_dbug= "+d,corrupt_queue_event";
|
||||
set @@global.debug_dbug= "+d,pause_before_io_read_event";
|
||||
set @@global.debug_dbug= "+d,placeholder";
|
||||
start slave io_thread;
|
||||
# Disable semi-sync on the slave while the IO thread is active
|
||||
set debug_sync='now wait_for io_thread_at_read_event';
|
||||
set @@global.rpl_semi_sync_slave_enabled= OFF;
|
||||
set debug_sync='now signal io_thread_continue_read_event';
|
||||
# Waiting for the slave to stop with the error from corrupt_queue_event
|
||||
connection slave;
|
||||
include/wait_for_slave_io_error.inc [errno=1595,1743]
|
||||
# Sleep 1 to give time for Ack_receiver to receive COM_QUIT
|
||||
include/assert_grep.inc [Check that there is no 'Read semi-sync reply magic number error' in error log.]
|
||||
#
|
||||
# Cleanup
|
||||
connection slave;
|
||||
include/stop_slave.inc
|
||||
set @@global.debug_dbug= @old_dbug;
|
||||
include/start_slave.inc
|
||||
connection master;
|
||||
set @@global.rpl_semi_sync_master_enabled= default;
|
||||
include/rpl_end.inc
|
||||
# End of rpl_semi_sync_slave_enabled_consistent.test
|
@@ -4,6 +4,7 @@ connection slave;
|
||||
include/stop_slave.inc
|
||||
connection master;
|
||||
call mtr.add_suppression("Timeout waiting for reply of binlog*");
|
||||
call mtr.add_suppression("Master server does not read semi-sync messages*");
|
||||
set global rpl_semi_sync_master_enabled = ON;
|
||||
SET @@GLOBAL.rpl_semi_sync_master_timeout=100;
|
||||
create table t1 (i int);
|
||||
@@ -15,8 +16,8 @@ SET GLOBAL debug_dbug="+d,semislave_failed_net_flush";
|
||||
include/start_slave.inc
|
||||
connection master;
|
||||
connection slave;
|
||||
"Assert that the net_fulsh() reply failed is present in slave error log.
|
||||
FOUND 1 /Semi-sync slave net_flush\(\) reply failed/ in mysqld.2.err
|
||||
"Assert that Master server does not read semi-sync messages" is present in slave error log.
|
||||
FOUND 1 /Master server does not read semi-sync messages/ in mysqld.2.err
|
||||
"Assert that Slave IO thread is up and running."
|
||||
SHOW STATUS LIKE 'Slave_running';
|
||||
Variable_name Value
|
||||
|
@@ -14,7 +14,6 @@ CALL mtr.add_suppression("Failed on request_dump()*");
|
||||
CALL mtr.add_suppression("Semi-sync master failed on*");
|
||||
CALL mtr.add_suppression("Master command COM_BINLOG_DUMP failed*");
|
||||
CALL mtr.add_suppression("on master failed*");
|
||||
CALL mtr.add_suppression("Master server does not support semi-sync*");
|
||||
CALL mtr.add_suppression("Semi-sync slave net_flush*");
|
||||
CALL mtr.add_suppression("Failed to flush master info*");
|
||||
CALL mtr.add_suppression("Request to stop slave SQL Thread received while apply*");
|
||||
@@ -196,7 +195,7 @@ Variable_name Value
|
||||
Rpl_semi_sync_master_clients 0
|
||||
show status like 'Rpl_semi_sync_master_status';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_status OFF
|
||||
Rpl_semi_sync_master_status ON
|
||||
connection slave;
|
||||
START SLAVE IO_THREAD;
|
||||
include/wait_for_slave_io_to_start.inc
|
||||
|
@@ -1,5 +1,16 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
select @@rpl_semi_sync_master_enabled;
|
||||
@@rpl_semi_sync_master_enabled
|
||||
0
|
||||
connection slave;
|
||||
select @@rpl_semi_sync_slave_enabled;
|
||||
@@rpl_semi_sync_slave_enabled
|
||||
0
|
||||
show status like "rpl_semi_sync_slave_status";
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_slave_status OFF
|
||||
connection master;
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'test.t1'
|
||||
|
69
mysql-test/suite/rpl/r/rpl_session_var2.result
Normal file
69
mysql-test/suite/rpl/r/rpl_session_var2.result
Normal file
@@ -0,0 +1,69 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
select @@rpl_semi_sync_master_enabled;
|
||||
@@rpl_semi_sync_master_enabled
|
||||
1
|
||||
connection slave;
|
||||
select @@rpl_semi_sync_slave_enabled;
|
||||
@@rpl_semi_sync_slave_enabled
|
||||
1
|
||||
show status like "rpl_semi_sync_slave_status";
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_slave_status ON
|
||||
connection master;
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'test.t1'
|
||||
create table t1(a varchar(100),b int);
|
||||
set @@session.sql_mode=pipes_as_concat;
|
||||
insert into t1 values('My'||'SQL', 1);
|
||||
set @@session.sql_mode=default;
|
||||
insert into t1 values('1'||'2', 2);
|
||||
select * from t1 where b<3 order by a;
|
||||
a b
|
||||
1 2
|
||||
MySQL 1
|
||||
connection slave;
|
||||
select * from t1 where b<3 order by a;
|
||||
a b
|
||||
1 2
|
||||
MySQL 1
|
||||
connection master;
|
||||
set @@session.sql_mode=ignore_space;
|
||||
insert into t1 values(password ('MySQL'), 3);
|
||||
set @@session.sql_mode=ansi_quotes;
|
||||
create table "t2" ("a" int);
|
||||
drop table t1, t2;
|
||||
set @@session.sql_mode=default;
|
||||
create table t1(a int auto_increment primary key);
|
||||
create table t2(b int, a int);
|
||||
set @@session.sql_auto_is_null=1;
|
||||
insert into t1 values(null);
|
||||
insert into t2 select 1,a from t1 where a is null;
|
||||
set @@session.sql_auto_is_null=0;
|
||||
insert into t1 values(null);
|
||||
insert into t2 select 2,a from t1 where a is null;
|
||||
select * from t2 order by b;
|
||||
b a
|
||||
1 1
|
||||
connection slave;
|
||||
select * from t2 order by b;
|
||||
b a
|
||||
1 1
|
||||
connection master;
|
||||
drop table t1,t2;
|
||||
connection slave;
|
||||
connection master;
|
||||
CREATE TABLE t1 (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`data` varchar(100),
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t1(data) VALUES(SESSION_USER());
|
||||
connection slave;
|
||||
SELECT length(data) < 100 FROM t1;
|
||||
length(data) < 100
|
||||
1
|
||||
connection master;
|
||||
drop table t1;
|
||||
include/rpl_end.inc
|
@@ -79,7 +79,9 @@ domain_id seq_no
|
||||
0 5
|
||||
include/start_slave.inc
|
||||
connection master;
|
||||
include/save_master_gtid.inc
|
||||
connection slave;
|
||||
include/sync_with_master_gtid.inc
|
||||
# Everything from the master binlog must have been applied now:
|
||||
select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1;
|
||||
domain_id seq_no
|
||||
|
@@ -117,7 +117,10 @@ include/start_slave.inc
|
||||
# not master_use_gtid=no should warn the user that Using_Gtid is being
|
||||
# changed to No.
|
||||
#
|
||||
connection master;
|
||||
include/save_master_pos.inc
|
||||
connection slave;
|
||||
include/sync_io_with_master.inc
|
||||
include/stop_slave.inc
|
||||
CHANGE MASTER TO master_log_pos=io_log_pos, master_log_file='io_log_file';
|
||||
Warnings:
|
||||
|
@@ -59,7 +59,7 @@ if(!$log_error_)
|
||||
--let SEARCH_FILE=$log_error_
|
||||
--let SEARCH_RANGE=-50000
|
||||
--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'\'\).*
|
||||
--source include/search_pattern_in_file.inc
|
||||
--source include/wait_for_pattern_in_file.inc
|
||||
|
||||
--connection slave
|
||||
--source include/stop_slave.inc
|
||||
@@ -71,7 +71,7 @@ CHANGE MASTER TO MASTER_USE_GTID=no;
|
||||
--let SEARCH_FILE=$log_error_
|
||||
--let SEARCH_RANGE=-50000
|
||||
--let SEARCH_PATTERN=using_gtid\(0\), gtid\(\'\'\).*
|
||||
--source include/search_pattern_in_file.inc
|
||||
--source include/wait_for_pattern_in_file.inc
|
||||
CREATE TABLE t (f INT) ENGINE=INNODB;
|
||||
INSERT INTO t VALUES(10);
|
||||
save_master_pos;
|
||||
@@ -89,7 +89,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
|
||||
--let SEARCH_FILE=$log_error_
|
||||
--let SEARCH_RANGE=-50000
|
||||
--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'0-1-2\'\).*
|
||||
--source include/search_pattern_in_file.inc
|
||||
--source include/wait_for_pattern_in_file.inc
|
||||
SET @@SESSION.gtid_domain_id=10;
|
||||
INSERT INTO t VALUES(20);
|
||||
save_master_pos;
|
||||
@@ -107,7 +107,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
|
||||
--let SEARCH_FILE=$log_error_
|
||||
--let SEARCH_RANGE=-50000
|
||||
--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'0-1-2,10-1-1\'\).*
|
||||
--source include/search_pattern_in_file.inc
|
||||
--source include/wait_for_pattern_in_file.inc
|
||||
|
||||
--echo "===== Clean up ====="
|
||||
--connection slave
|
||||
|
@@ -7,6 +7,9 @@
|
||||
--source include/have_binlog_format_mixed.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
connection server_2;
|
||||
call mtr.add_suppression("Timeout waiting for reply of binlog");
|
||||
|
||||
# The following tests prove
|
||||
# A.
|
||||
# no out-of-order gtid error is done to the stict gtid mode semisync
|
||||
@@ -66,10 +69,18 @@ evalp CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_2, ma
|
||||
--connection server_2
|
||||
set @@global.gtid_strict_mode = true;
|
||||
set @@global.rpl_semi_sync_master_enabled = 1;
|
||||
|
||||
# The following command is likely to cause the slave master is not yet setup
|
||||
# for semi-sync
|
||||
|
||||
INSERT INTO t1(a) VALUES (2);
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection server_1
|
||||
# Update slave to notice that server_2 now has rpl_semi_sync_master_enabled
|
||||
--source include/stop_slave.inc
|
||||
--source include/start_slave.inc
|
||||
|
||||
--echo #
|
||||
--echo # the successful sync is a required proof
|
||||
--echo #
|
||||
|
@@ -192,6 +192,12 @@ eval CHANGE MASTER TO MASTER_DELAY = $time2;
|
||||
--enable_query_log
|
||||
--source include/start_slave.inc
|
||||
|
||||
# Ensure that slave has started properly
|
||||
--connection master
|
||||
INSERT INTO t1 VALUES ('Syncing slave', 5);
|
||||
--save_master_pos
|
||||
--sync_slave_with_master
|
||||
|
||||
--connection master
|
||||
INSERT INTO t1 VALUES (delay_on_slave(1), 6);
|
||||
--save_master_pos
|
||||
|
@@ -67,10 +67,26 @@ connection master;
|
||||
save_master_pos;
|
||||
|
||||
--connection slave
|
||||
|
||||
# Left to its own devices, the IO thread may or may not stop in error,
|
||||
# depending on what it is doing when its connection to the primary is killed
|
||||
# (e.g. a failed read results in an error, whereas if the IO thread is idly
|
||||
# waiting for events when the connection dies, it will enter into a reconnect
|
||||
# loop and reconnect). So we manually stop/start the IO thread to ensure it is
|
||||
# in a consistent state
|
||||
#
|
||||
# FIXME: We shouldn't need to stop/start the SQL thread here, but due to
|
||||
# MDEV-33268, we have to. So after fixing 33268, this should only stop/start
|
||||
# the IO thread. Note the SQL thread must be stopped first due to an invalid
|
||||
# DBUG_ASSERT in the IO thread's stop logic that depends on the state of the
|
||||
# SQL thread (also reported and to be fixed in the same ticket).
|
||||
#
|
||||
--source include/stop_slave_sql.inc
|
||||
--let rpl_allow_error=1
|
||||
--source include/wait_for_slave_io_to_start.inc
|
||||
--source include/stop_slave_io.inc
|
||||
--let rpl_allow_error=
|
||||
--source include/wait_for_slave_sql_to_start.inc
|
||||
--source include/start_slave.inc
|
||||
|
||||
sync_with_master;
|
||||
select * from ti;
|
||||
select * from tm;
|
||||
|
@@ -11,7 +11,7 @@ set @old_master_binlog_checksum= @@global.binlog_checksum;
|
||||
# empty Gtid_list event
|
||||
#
|
||||
# Test this by binlog rotation before we log any GTIDs.
|
||||
connection slave;
|
||||
sync_slave_with_master;
|
||||
|
||||
# Need to stop/start the master without GTID before setting debug_dbug
|
||||
--source include/stop_slave.inc
|
||||
|
@@ -33,7 +33,8 @@ CHANGE MASTER TO MASTER_USE_GTID=NO;
|
||||
|
||||
--source include/stop_slave.inc
|
||||
SET @save_dbug= @@GLOBAL.debug_dbug;
|
||||
SET @@global.debug_dbug="+d,pause_sql_thread_on_fde,negate_clock_diff_with_master";
|
||||
SET @@global.debug_dbug="+d,pause_sql_thread_on_relay_fde_after_trans";
|
||||
SET @@global.debug_dbug="+d,negate_clock_diff_with_master";
|
||||
--source include/start_slave.inc
|
||||
|
||||
--let $sleep_time=2
|
||||
@@ -52,12 +53,6 @@ insert into t1 values (1);
|
||||
flush logs;
|
||||
|
||||
--connection slave
|
||||
--echo # Ignore FDEs that happen before the CREATE/INSERT commands
|
||||
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
|
||||
SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
|
||||
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
|
||||
SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
|
||||
|
||||
--echo # On the next FDE, the slave should have the master CREATE/INSERT events
|
||||
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
|
||||
select count(*)=1 from t1;
|
||||
@@ -138,6 +133,7 @@ while (!$caught_up)
|
||||
}
|
||||
sleep 0.1;
|
||||
}
|
||||
set debug_sync="RESET";
|
||||
--enable_query_log
|
||||
|
||||
--connection master
|
||||
|
@@ -23,7 +23,6 @@ connection slave;
|
||||
# inconsistent GTID values because the seq_nos are non-deterministic with
|
||||
# the masters events coming in concurrently
|
||||
set sql_log_bin=0;
|
||||
call mtr.add_suppression("Master server does not support semi-sync");
|
||||
call mtr.add_suppression("Semi-sync slave .* reply");
|
||||
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
|
||||
set sql_log_bin=1;
|
||||
@@ -58,7 +57,7 @@ set global rpl_semi_sync_slave_enabled= 0;
|
||||
|
||||
connection master;
|
||||
|
||||
set global rpl_semi_sync_master_timeout= 60000; # 60s
|
||||
set global rpl_semi_sync_master_timeout= 2000; # 2s
|
||||
|
||||
echo [ default state of semi-sync on master should be OFF ];
|
||||
show variables like 'rpl_semi_sync_master_enabled';
|
||||
@@ -202,12 +201,16 @@ sync_slave_with_master;
|
||||
--echo # Test semi-sync master will switch OFF after one transaction
|
||||
--echo # timeout waiting for slave reply.
|
||||
--echo #
|
||||
|
||||
connection master;
|
||||
show status like "Rpl_semi_sync_master_status";
|
||||
|
||||
connection slave;
|
||||
source include/stop_slave.inc;
|
||||
|
||||
connection master;
|
||||
--source include/kill_binlog_dump_threads.inc
|
||||
set global rpl_semi_sync_master_timeout= 5000;
|
||||
set global rpl_semi_sync_master_timeout= 2000;
|
||||
|
||||
# The first semi-sync check should be on because after slave stop,
|
||||
# there are no transactions on the master.
|
||||
@@ -239,8 +242,8 @@ show status like 'Rpl_semi_sync_master_status';
|
||||
show status like 'Rpl_semi_sync_master_no_tx';
|
||||
show status like 'Rpl_semi_sync_master_yes_tx';
|
||||
|
||||
# Semi-sync status on master is now OFF, so all these transactions
|
||||
# will be replicated asynchronously.
|
||||
# Semi-sync status on master is now ON, but there are no slaves attached,
|
||||
# so all these transactions will be replicated asynchronously.
|
||||
delete from t1 where a=10;
|
||||
delete from t1 where a=9;
|
||||
delete from t1 where a=8;
|
||||
@@ -374,6 +377,9 @@ let $status_var= Rpl_semi_sync_master_clients;
|
||||
let $status_var_value= 1;
|
||||
source include/wait_for_status_var.inc;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
replace_result $engine_type ENGINE_TYPE;
|
||||
eval create table t1 (a int) engine = $engine_type;
|
||||
insert into t1 values (1);
|
||||
@@ -420,6 +426,10 @@ connection master;
|
||||
let $status_var= Rpl_semi_sync_master_clients;
|
||||
let $status_var_value= 1;
|
||||
source include/wait_for_status_var.inc;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
echo [ master semi-sync should be ON ];
|
||||
show status like 'Rpl_semi_sync_master_clients';
|
||||
show status like 'Rpl_semi_sync_master_status';
|
||||
|
@@ -14,7 +14,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
|
||||
call mtr.add_suppression("mysqld: Got an error reading communication packets");
|
||||
|
||||
connection slave;
|
||||
call mtr.add_suppression("Master server does not support semi-sync");
|
||||
call mtr.add_suppression("Semi-sync slave .* reply");
|
||||
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
|
||||
|
||||
|
@@ -18,6 +18,7 @@
|
||||
--connection server_1
|
||||
RESET MASTER;
|
||||
SET @@global.max_binlog_size= 4096;
|
||||
set @@global.rpl_semi_sync_master_enabled = 1;
|
||||
|
||||
--connection server_2
|
||||
RESET MASTER;
|
||||
@@ -29,7 +30,6 @@ CHANGE MASTER TO master_use_gtid= slave_pos;
|
||||
|
||||
--connection server_1
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
|
||||
set @@global.rpl_semi_sync_master_enabled = 1;
|
||||
set @@global.rpl_semi_sync_master_wait_point=AFTER_SYNC;
|
||||
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
|
||||
|
@@ -0,0 +1,12 @@
|
||||
!include include/default_mysqld.cnf
|
||||
|
||||
[mysqld.1]
|
||||
|
||||
[mysqld.2]
|
||||
|
||||
[mysqld.3]
|
||||
|
||||
[ENV]
|
||||
SERVER_MYPORT_1= @mysqld.1.port
|
||||
SERVER_MYPORT_2= @mysqld.2.port
|
||||
SERVER_MYPORT_3= @mysqld.3.port
|
@@ -0,0 +1,122 @@
|
||||
#
|
||||
# This test ensures that a primary will listen for ACKs by newly added
|
||||
# semi-sync connections connections, after a pre-existing connection is already
|
||||
# established. MDEV-32960 reported that the newly added slave's ACK can be
|
||||
# ignored if listen_on_sockets() does not timeout before
|
||||
# rpl_semi_sync_master_timeout, and if the existing semi-sync connections fail
|
||||
# to send ACKs, semi-sync is switched off.
|
||||
#
|
||||
# This test ensures this in a two-replica setup with a semi-sync timeout of
|
||||
# 500ms, and delaying the ACK reply of the first-established replica by 800ms
|
||||
# to force a timeout, and allowing the second replica to immediately ACK.
|
||||
#
|
||||
# References:
|
||||
# MDEV-32960: Semi-sync ACKed Transaction can Timeout and Switch Off
|
||||
# Semi-sync with Multiple Replicas
|
||||
#
|
||||
--source include/have_debug.inc
|
||||
# binlog_format independent
|
||||
--source include/have_binlog_format_statement.inc
|
||||
|
||||
--let $rpl_topology= 1->2,1->3
|
||||
--source include/rpl_init.inc
|
||||
|
||||
|
||||
--connection server_1
|
||||
set @old_enabled= @@global.rpl_semi_sync_master_enabled;
|
||||
set @old_timeout= @@global.rpl_semi_sync_master_timeout;
|
||||
set global rpl_semi_sync_master_enabled= 1;
|
||||
set global rpl_semi_sync_master_timeout= 500;
|
||||
|
||||
--connection server_2
|
||||
--source include/stop_slave.inc
|
||||
set @old_enabled= @@global.rpl_semi_sync_slave_enabled;
|
||||
set @old_dbug= @@global.debug_dbug;
|
||||
set global rpl_semi_sync_slave_enabled= 1;
|
||||
set global debug_dbug="+d,simulate_delay_semisync_slave_reply";
|
||||
--source include/start_slave.inc
|
||||
|
||||
--connection server_3
|
||||
--source include/stop_slave.inc
|
||||
set @old_enabled= @@global.rpl_semi_sync_slave_enabled;
|
||||
set global rpl_semi_sync_slave_enabled= 1;
|
||||
--source include/start_slave.inc
|
||||
|
||||
--echo # Ensure primary recognizes both replicas are semi-sync
|
||||
--connection server_1
|
||||
--let $status_var_value= 2
|
||||
--let $status_var= rpl_semi_sync_master_clients
|
||||
--source include/wait_for_status_var.inc
|
||||
|
||||
--let $master_ss_status= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_master_status', Value, 1)
|
||||
if (`SELECT strcmp("$master_ss_status", "ON") != 0`)
|
||||
{
|
||||
SHOW STATUS LIKE 'rpl_semi_sync_master_status';
|
||||
--die rpl_semi_sync_master_status should be ON to start
|
||||
}
|
||||
|
||||
--connection server_1
|
||||
--let $init_master_yes_tx= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_master_yes_tx', Value, 1)
|
||||
create table t1 (a int);
|
||||
|
||||
--connection server_2
|
||||
--echo # Verifying server_2 did not send ACK
|
||||
--let $slave1_sent_ack= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_slave_send_ack', Value, 1)
|
||||
if (`SELECT $slave1_sent_ack`)
|
||||
{
|
||||
SHOW STATUS LIKE 'rpl_semi_sync_slave_send_ack';
|
||||
--die server_2 should not have sent semi-sync ACK to primary
|
||||
}
|
||||
|
||||
--connection server_3
|
||||
--echo # Verifying server_3 did send ACK
|
||||
--let $slave2_sent_ack= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_slave_send_ack', Value, 1)
|
||||
if (`SELECT NOT $slave2_sent_ack`)
|
||||
{
|
||||
SHOW STATUS LIKE 'rpl_semi_sync_slave_send_ack';
|
||||
--die server_3 should have sent semi-sync ACK to primary
|
||||
}
|
||||
|
||||
--connection server_1
|
||||
--echo # Verifying master's semi-sync status is still ON (This failed pre-MDEV-32960 fixes)
|
||||
let $master_ss_status= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_master_status', Value, 1);
|
||||
if (`SELECT strcmp("$master_ss_status", "ON") != 0`)
|
||||
{
|
||||
SHOW STATUS LIKE 'rpl_semi_sync_master_status';
|
||||
--die rpl_semi_sync_master_status should not have switched off after server_3 ACKed transaction
|
||||
}
|
||||
|
||||
--echo # Verifying rpl_semi_sync_master_yes_tx incremented
|
||||
--let $cur_master_yes_tx= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_master_yes_tx', Value, 1)
|
||||
if (`SELECT $cur_master_yes_tx != ($init_master_yes_tx + 1)`)
|
||||
{
|
||||
--echo # Initial yes_tx: $init_master_yes_tx
|
||||
--echo # Current yes_tx: $cur_master_yes_tx
|
||||
--die rpl_semi_sync_master_yes_tx should have been incremented by primary
|
||||
}
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Cleanup
|
||||
|
||||
--connection server_2
|
||||
set global rpl_semi_sync_slave_enabled= @old_enabled;
|
||||
set global debug_dbug= @old_dbug;
|
||||
--source include/stop_slave.inc
|
||||
|
||||
--connection server_3
|
||||
set global rpl_semi_sync_slave_enabled= @old_enabled;
|
||||
--source include/stop_slave.inc
|
||||
|
||||
--connection server_1
|
||||
set global rpl_semi_sync_master_enabled= @old_enabled;
|
||||
set global rpl_semi_sync_master_timeout= @old_timeout;
|
||||
drop table t1;
|
||||
|
||||
--connection server_2
|
||||
--source include/start_slave.inc
|
||||
--connection server_3
|
||||
--source include/start_slave.inc
|
||||
|
||||
--source include/rpl_end.inc
|
||||
--echo # End of rpl_semi_sync_no_missed_ack_after_add_slave.test
|
@@ -0,0 +1,73 @@
|
||||
#
|
||||
# MDEV-32551: "Read semi-sync reply magic number error" warnings on master
|
||||
#
|
||||
# Test that changing rpl_semi_sync_master_enabled after startup does not
|
||||
# cause problems with semi-sync cleanup.
|
||||
#
|
||||
|
||||
--source include/have_debug.inc
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
# Test is binlog format independent, so save resources
|
||||
--source include/have_binlog_format_row.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
call mtr.add_suppression("Replication event checksum verification failed");
|
||||
call mtr.add_suppression("could not queue event from master");
|
||||
|
||||
--echo #
|
||||
--echo # Set up a semisync connection
|
||||
--connection master
|
||||
set @@global.rpl_semi_sync_master_enabled= ON;
|
||||
|
||||
--connection slave
|
||||
stop slave io_thread;
|
||||
set @@global.rpl_semi_sync_slave_enabled= ON;
|
||||
set @old_dbug= @@global.debug_dbug;
|
||||
|
||||
# Force an error to abort out of the main IO thread loop
|
||||
set @@global.debug_dbug= "+d,corrupt_queue_event";
|
||||
|
||||
# Pause the IO thread as soon as the main loop starts. Note we can't use
|
||||
# processlist where "Waiting for master to send event" because the
|
||||
# "corrupt_queue_event" will trigger before we can turn semisync OFF
|
||||
set @@global.debug_dbug= "+d,pause_before_io_read_event";
|
||||
|
||||
# Because the other debug_dbug points are automatically negated when they are
|
||||
# run, and there is a bug that if "-d" takes us to an empty debug string state,
|
||||
# _all_ debug_print statements are output
|
||||
set @@global.debug_dbug= "+d,placeholder";
|
||||
|
||||
start slave io_thread;
|
||||
|
||||
--echo # Disable semi-sync on the slave while the IO thread is active
|
||||
set debug_sync='now wait_for io_thread_at_read_event';
|
||||
set @@global.rpl_semi_sync_slave_enabled= OFF;
|
||||
set debug_sync='now signal io_thread_continue_read_event';
|
||||
|
||||
--echo # Waiting for the slave to stop with the error from corrupt_queue_event
|
||||
--connection slave
|
||||
--let $slave_io_errno= 1595,1743
|
||||
--source include/wait_for_slave_io_error.inc
|
||||
|
||||
--echo # Sleep 1 to give time for Ack_receiver to receive COM_QUIT
|
||||
--sleep 1
|
||||
|
||||
--let $assert_text= Check that there is no 'Read semi-sync reply magic number error' in error log.
|
||||
--let $assert_select=magic number error
|
||||
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
|
||||
--let $assert_count= 0
|
||||
--let $assert_only_after=CURRENT_TEST
|
||||
--source include/assert_grep.inc
|
||||
|
||||
--echo #
|
||||
--echo # Cleanup
|
||||
--connection slave
|
||||
--source include/stop_slave.inc
|
||||
set @@global.debug_dbug= @old_dbug;
|
||||
--source include/start_slave.inc
|
||||
--connection master
|
||||
set @@global.rpl_semi_sync_master_enabled= default;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
--echo # End of rpl_semi_sync_slave_enabled_consistent.test
|
@@ -31,6 +31,7 @@
|
||||
|
||||
--connection master
|
||||
call mtr.add_suppression("Timeout waiting for reply of binlog*");
|
||||
call mtr.add_suppression("Master server does not read semi-sync messages*");
|
||||
--let $sav_timeout_master=`SELECT @@GLOBAL.rpl_semi_sync_master_timeout`
|
||||
set global rpl_semi_sync_master_enabled = ON;
|
||||
SET @@GLOBAL.rpl_semi_sync_master_timeout=100;
|
||||
@@ -54,9 +55,9 @@ if(!$log_error_)
|
||||
# does not know the location of its .err log, use default location
|
||||
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.2.err;
|
||||
}
|
||||
--echo "Assert that the net_fulsh() reply failed is present in slave error log.
|
||||
--echo "Assert that Master server does not read semi-sync messages" is present in slave error log.
|
||||
--let SEARCH_FILE=$log_error_
|
||||
--let SEARCH_PATTERN=Semi-sync slave net_flush\(\) reply failed
|
||||
--let SEARCH_PATTERN=Master server does not read semi-sync messages
|
||||
--source include/search_pattern_in_file.inc
|
||||
|
||||
--echo "Assert that Slave IO thread is up and running."
|
||||
|
@@ -16,7 +16,6 @@ CALL mtr.add_suppression("Failed on request_dump()*");
|
||||
CALL mtr.add_suppression("Semi-sync master failed on*");
|
||||
CALL mtr.add_suppression("Master command COM_BINLOG_DUMP failed*");
|
||||
CALL mtr.add_suppression("on master failed*");
|
||||
CALL mtr.add_suppression("Master server does not support semi-sync*");
|
||||
CALL mtr.add_suppression("Semi-sync slave net_flush*");
|
||||
CALL mtr.add_suppression("Failed to flush master info*");
|
||||
CALL mtr.add_suppression("Request to stop slave SQL Thread received while apply*");
|
||||
|
@@ -7,6 +7,12 @@ disable_query_log;
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||
enable_query_log;
|
||||
|
||||
select @@rpl_semi_sync_master_enabled;
|
||||
connection slave;
|
||||
select @@rpl_semi_sync_slave_enabled;
|
||||
show status like "rpl_semi_sync_slave_status";
|
||||
connection master;
|
||||
|
||||
drop table if exists t1;
|
||||
create table t1(a varchar(100),b int);
|
||||
set @@session.sql_mode=pipes_as_concat;
|
||||
|
1
mysql-test/suite/rpl/t/rpl_session_var2-master.opt
Normal file
1
mysql-test/suite/rpl/t/rpl_session_var2-master.opt
Normal file
@@ -0,0 +1 @@
|
||||
--rpl_semi_sync_master_enabled=1 --rpl_semi_sync_slave_enabled=1
|
1
mysql-test/suite/rpl/t/rpl_session_var2-slave.opt
Normal file
1
mysql-test/suite/rpl/t/rpl_session_var2-slave.opt
Normal file
@@ -0,0 +1 @@
|
||||
--rpl_semi_sync_slave_enabled=1
|
3
mysql-test/suite/rpl/t/rpl_session_var2.test
Normal file
3
mysql-test/suite/rpl/t/rpl_session_var2.test
Normal file
@@ -0,0 +1,3 @@
|
||||
# Replication of session variables when semi-sync is on
|
||||
|
||||
--source rpl_session_var.test
|
@@ -28,6 +28,9 @@ while (`SELECT $i <= $slaves`)
|
||||
--inc $i
|
||||
}
|
||||
|
||||
# The following script will restart master and slaves. This will also set
|
||||
# rpl_semi_sync_master_enabled=0
|
||||
|
||||
--source include/rpl_shutdown_wait_slaves.inc
|
||||
--let i= 2
|
||||
while (`SELECT $i <= $slaves`)
|
||||
|
@@ -90,8 +90,12 @@ SET GLOBAL debug_dbug= @old_debug_slave;
|
||||
|
||||
select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1;
|
||||
--source include/start_slave.inc
|
||||
|
||||
--connection master
|
||||
--sync_slave_with_master
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
--connection slave
|
||||
--source include/sync_with_master_gtid.inc
|
||||
--echo # Everything from the master binlog must have been applied now:
|
||||
select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1;
|
||||
--let $slave_gtid_state = `select @@gtid_binlog_state`
|
||||
|
@@ -271,7 +271,10 @@ eval set global gtid_slave_pos="$old_slave_pos";
|
||||
--echo # not master_use_gtid=no should warn the user that Using_Gtid is being
|
||||
--echo # changed to No.
|
||||
--echo #
|
||||
--connection master
|
||||
--source include/save_master_pos.inc
|
||||
--connection slave
|
||||
--source include/sync_io_with_master.inc
|
||||
--let $io_log_pos= query_get_value('SHOW SLAVE STATUS', Read_Master_Log_Pos, 1)
|
||||
--let $io_log_file= query_get_value('SHOW SLAVE STATUS', Master_Log_File, 1)
|
||||
--source include/stop_slave.inc
|
||||
|
Reference in New Issue
Block a user