mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge 10.11 into 11.0
This commit is contained in:
@@ -683,6 +683,23 @@ 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=invalid;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'invalid' at line 1
|
||||
#
|
||||
# MDEV-31768
|
||||
# Ensure MASTER_DEMOTE_TO_REPLICA aliases MASTER_DEMOTE_TO_SLAVE
|
||||
#
|
||||
connection slave;
|
||||
RESET MASTER;
|
||||
include/reset_slave.inc
|
||||
CREATE TABLE t_mdev_31768 (a int);
|
||||
CHANGE MASTER TO master_use_gtid=Replica_Pos, master_demote_to_replica=1;
|
||||
# Validating alias MASTER_DEMOTE_TO_REPLICA provides intended behavior..
|
||||
# ..success
|
||||
DROP TABLE t_mdev_31768;
|
||||
RESET MASTER;
|
||||
include/reset_slave.inc
|
||||
# Clear primary binlog state to match replica
|
||||
connection master;
|
||||
RESET MASTER;
|
||||
#
|
||||
# Cleanup
|
||||
#
|
||||
connection master;
|
||||
|
@@ -11,6 +11,7 @@ SELECT * FROM t1;
|
||||
i
|
||||
1
|
||||
connection slave;
|
||||
include/save_master_gtid.inc
|
||||
connection slave;
|
||||
call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*");
|
||||
# Case 0 : Start slave with IGNORE_DOMAIN_IDS=(), then restart
|
||||
@@ -24,6 +25,7 @@ DO_DOMAIN_IDS (BEFORE) :
|
||||
IGNORE_DOMAIN_IDS (BEFORE) :
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
DO_DOMAIN_IDS (AFTER) :
|
||||
IGNORE_DOMAIN_IDS (AFTER) :
|
||||
SET @saved_dbug = @@GLOBAL.debug_dbug;
|
||||
@@ -33,6 +35,7 @@ START TRANSACTION;
|
||||
INSERT INTO t1 VALUES(2);
|
||||
INSERT INTO t1 VALUES(3);
|
||||
COMMIT;
|
||||
include/save_master_gtid.inc
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
1
|
||||
@@ -46,6 +49,7 @@ i
|
||||
SET @@global.debug_dbug=@saved_dbug;
|
||||
START SLAVE io_thread;
|
||||
include/wait_for_slave_io_to_start.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
1
|
||||
@@ -59,6 +63,7 @@ DO_DOMAIN_IDS (BEFORE) :
|
||||
IGNORE_DOMAIN_IDS (BEFORE) :
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
DO_DOMAIN_IDS (AFTER) :
|
||||
IGNORE_DOMAIN_IDS (AFTER) : 1
|
||||
SET @@global.debug_dbug="d,kill_slave_io_before_commit";
|
||||
@@ -67,6 +72,7 @@ START TRANSACTION;
|
||||
INSERT INTO t1 VALUES(4);
|
||||
INSERT INTO t1 VALUES(5);
|
||||
COMMIT;
|
||||
include/save_master_gtid.inc
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
1
|
||||
@@ -84,6 +90,7 @@ i
|
||||
SET @@global.debug_dbug=@saved_dbug;
|
||||
START SLAVE io_thread;
|
||||
include/wait_for_slave_io_to_start.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
1
|
||||
@@ -97,6 +104,7 @@ DO_DOMAIN_IDS (BEFORE) :
|
||||
IGNORE_DOMAIN_IDS (BEFORE) : 1
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
DO_DOMAIN_IDS (AFTER) :
|
||||
IGNORE_DOMAIN_IDS (AFTER) :
|
||||
SET @@global.debug_dbug="d,kill_slave_io_before_commit";
|
||||
@@ -114,6 +122,7 @@ START TRANSACTION;
|
||||
INSERT INTO t1 VALUES(10);
|
||||
INSERT INTO t1 VALUES(11);
|
||||
COMMIT;
|
||||
include/save_master_gtid.inc
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
1
|
||||
@@ -140,6 +149,7 @@ DO_DOMAIN_IDS (BEFORE) :
|
||||
IGNORE_DOMAIN_IDS (BEFORE) :
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
DO_DOMAIN_IDS (AFTER) :
|
||||
IGNORE_DOMAIN_IDS (AFTER) : 1
|
||||
SELECT * FROM t1;
|
||||
@@ -157,6 +167,7 @@ DO_DOMAIN_IDS (BEFORE) :
|
||||
IGNORE_DOMAIN_IDS (BEFORE) : 1
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
DO_DOMAIN_IDS (AFTER) :
|
||||
IGNORE_DOMAIN_IDS (AFTER) : 1
|
||||
SET @@global.debug_dbug="d,kill_slave_io_before_commit";
|
||||
@@ -166,6 +177,7 @@ START TRANSACTION;
|
||||
INSERT INTO t1 VALUES(12);
|
||||
INSERT INTO t1 VALUES(13);
|
||||
COMMIT;
|
||||
include/save_master_gtid.inc
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 VALUES(14);
|
||||
INSERT INTO t1 VALUES(15);
|
||||
@@ -204,11 +216,16 @@ i
|
||||
10
|
||||
11
|
||||
SET @@global.debug_dbug=@saved_dbug;
|
||||
include/sync_with_master_gtid.inc
|
||||
include/stop_slave_sql.inc
|
||||
DO_DOMAIN_IDS (BEFORE) :
|
||||
IGNORE_DOMAIN_IDS (BEFORE) : 1
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
|
||||
connection master;
|
||||
include/save_master_gtid.inc
|
||||
connection slave;
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
DO_DOMAIN_IDS (AFTER) :
|
||||
IGNORE_DOMAIN_IDS (AFTER) :
|
||||
SELECT * FROM t1;
|
||||
@@ -230,6 +247,7 @@ DO_DOMAIN_IDS (BEFORE) :
|
||||
IGNORE_DOMAIN_IDS (BEFORE) :
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
DO_DOMAIN_IDS (AFTER) :
|
||||
IGNORE_DOMAIN_IDS (AFTER) : 1
|
||||
SET @@global.debug_dbug="d,kill_slave_io_after_2_events";
|
||||
@@ -239,6 +257,7 @@ START TRANSACTION;
|
||||
INSERT INTO t1 VALUES(18);
|
||||
INSERT INTO t1 VALUES(19);
|
||||
COMMIT;
|
||||
include/save_master_gtid.inc
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 VALUES(20);
|
||||
INSERT INTO t1 VALUES(21);
|
||||
@@ -287,11 +306,16 @@ i
|
||||
16
|
||||
17
|
||||
SET @@global.debug_dbug=@saved_dbug;
|
||||
include/sync_with_master_gtid.inc
|
||||
include/stop_slave_sql.inc
|
||||
DO_DOMAIN_IDS (BEFORE) :
|
||||
IGNORE_DOMAIN_IDS (BEFORE) : 1
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
|
||||
connection master;
|
||||
include/save_master_gtid.inc
|
||||
connection slave;
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
DO_DOMAIN_IDS (AFTER) :
|
||||
IGNORE_DOMAIN_IDS (AFTER) :
|
||||
SELECT * FROM t1;
|
||||
@@ -317,6 +341,7 @@ DO_DOMAIN_IDS (BEFORE) :
|
||||
IGNORE_DOMAIN_IDS (BEFORE) :
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
DO_DOMAIN_IDS (AFTER) :
|
||||
IGNORE_DOMAIN_IDS (AFTER) :
|
||||
SET @@global.debug_dbug="d,kill_slave_io_after_2_events";
|
||||
@@ -335,6 +360,7 @@ START TRANSACTION;
|
||||
INSERT INTO t1 VALUES(28);
|
||||
INSERT INTO t1 VALUES(29);
|
||||
COMMIT;
|
||||
include/save_master_gtid.inc
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
1
|
||||
@@ -389,6 +415,7 @@ DO_DOMAIN_IDS (BEFORE) :
|
||||
IGNORE_DOMAIN_IDS (BEFORE) :
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
DO_DOMAIN_IDS (AFTER) :
|
||||
IGNORE_DOMAIN_IDS (AFTER) : 1
|
||||
SELECT * FROM t1;
|
||||
|
@@ -55,7 +55,6 @@ PARTITION pmax VALUES LESS THAN (MAXVALUE));
|
||||
INSERT INTO t1 VALUES (1), (10), (100), (1000);
|
||||
ALTER TABLE t1 ANALYZE PARTITION p0;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
ALTER TABLE t1 OPTIMIZE PARTITION p0;
|
||||
Table Op Msg_type Msg_text
|
||||
|
@@ -15,11 +15,15 @@ call mtr.add_suppression("reply failed");
|
||||
call mtr.add_suppression("Replication event checksum verification");
|
||||
call mtr.add_suppression("Relay log write failure");
|
||||
call mtr.add_suppression("Failed to kill the active semi-sync connection");
|
||||
set @sav_enabled_server_2= @@GLOBAL.rpl_semi_sync_slave_enabled;
|
||||
set @sav_server_2_dbug= @@GLOBAL.debug_dbug;
|
||||
connection server_3;
|
||||
call mtr.add_suppression("reply failed");
|
||||
call mtr.add_suppression("Replication event checksum verification");
|
||||
call mtr.add_suppression("Relay log write failure");
|
||||
call mtr.add_suppression("Failed to kill the active semi-sync connection");
|
||||
set @sav_enabled_server_3= @@GLOBAL.rpl_semi_sync_slave_enabled;
|
||||
set @sav_server_3_dbug= @@GLOBAL.debug_dbug;
|
||||
connection server_1;
|
||||
CREATE TABLE t1 (a int);
|
||||
connection server_2;
|
||||
@@ -40,15 +44,15 @@ connection server_1;
|
||||
#-- Enable semi-sync on slaves
|
||||
let slave_last= 3
|
||||
connection server_2;
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
include/stop_slave.inc
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
include/start_slave.inc
|
||||
show status like 'Rpl_semi_sync_slave_status';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_slave_status ON
|
||||
connection server_3;
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
include/stop_slave.inc
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
include/start_slave.inc
|
||||
show status like 'Rpl_semi_sync_slave_status';
|
||||
Variable_name Value
|
||||
@@ -67,24 +71,20 @@ show status like 'Rpl_semi_sync_master_clients';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_clients 2
|
||||
#-- Prepare servers to simulate delay or error
|
||||
connection server_1;
|
||||
SET @@GLOBAL.debug_dbug= "";
|
||||
connection server_2;
|
||||
SET @@GLOBAL.debug_dbug= "+d,simulate_delay_semisync_slave_reply";
|
||||
connection server_3;
|
||||
SET @@GLOBAL.debug_dbug= "+d,simulate_delay_semisync_slave_reply";
|
||||
#--
|
||||
#-- Test begins
|
||||
connection server_1_con2;
|
||||
#-- Give enough time after timeout/ack received to query yes_tx/no_tx
|
||||
SET @@GLOBAL.debug_dbug= "+d,delay_shutdown_phase_2_after_semisync_wait";
|
||||
connection server_1;
|
||||
#-- Begin semi-sync transaction
|
||||
INSERT INTO t1 VALUES (1);
|
||||
connection server_1_con2;
|
||||
#-- Wait until master recognizes a connection is awaiting semi-sync ACK
|
||||
show status like 'Rpl_semi_sync_master_wait_sessions';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_wait_sessions 1
|
||||
#-- Give enough time after timeout/ack received to query yes_tx/no_tx
|
||||
SET @@GLOBAL.debug_dbug= "+d,delay_shutdown_phase_2_after_semisync_wait";
|
||||
#-- Begin master shutdown
|
||||
SHUTDOWN WAIT FOR ALL SLAVES;
|
||||
connection server_1;
|
||||
@@ -111,22 +111,19 @@ count(*)=1
|
||||
#-- Re-synchronize slaves with master and disable semi-sync
|
||||
#-- Stop slaves
|
||||
connection server_2;
|
||||
SET @@GLOBAL.debug_dbug= "";
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0;
|
||||
include/stop_slave.inc
|
||||
include/stop_slave_io.inc
|
||||
include/stop_slave_sql.inc
|
||||
SET @@GLOBAL.debug_dbug= @sav_server_2_dbug;
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_2;
|
||||
connection server_3;
|
||||
SET @@GLOBAL.debug_dbug= "";
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0;
|
||||
include/stop_slave.inc
|
||||
include/stop_slave_io.inc
|
||||
include/stop_slave_sql.inc
|
||||
SET @@GLOBAL.debug_dbug= @sav_server_3_dbug;
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_3;
|
||||
#-- Bring the master back up
|
||||
connection server_1_con2;
|
||||
connection default;
|
||||
connection server_1;
|
||||
SET @@GLOBAL.debug_dbug= "";
|
||||
SET @@GLOBAL.rpl_semi_sync_master_enabled = 0;
|
||||
show status like 'Rpl_semi_sync_master_status';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_status OFF
|
||||
TRUNCATE TABLE t1;
|
||||
#-- Bring slaves back up
|
||||
connection server_2;
|
||||
@@ -157,15 +154,15 @@ connection server_1;
|
||||
#-- Enable semi-sync on slaves
|
||||
let slave_last= 3
|
||||
connection server_2;
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
include/stop_slave.inc
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
include/start_slave.inc
|
||||
show status like 'Rpl_semi_sync_slave_status';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_slave_status ON
|
||||
connection server_3;
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
include/stop_slave.inc
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
include/start_slave.inc
|
||||
show status like 'Rpl_semi_sync_slave_status';
|
||||
Variable_name Value
|
||||
@@ -184,24 +181,20 @@ show status like 'Rpl_semi_sync_master_clients';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_clients 2
|
||||
#-- Prepare servers to simulate delay or error
|
||||
connection server_1;
|
||||
SET @@GLOBAL.debug_dbug= "+d,mysqld_delay_kill_threads_phase_1";
|
||||
connection server_2;
|
||||
SET @@GLOBAL.debug_dbug= "+d,corrupt_queue_event";
|
||||
SET @@GLOBAL.debug_dbug= "+d,corrupt_queue_event,delay_semisync_kill_connection_for_mdev_28141";
|
||||
connection server_3;
|
||||
SET @@GLOBAL.debug_dbug= "+d,corrupt_queue_event";
|
||||
SET @@GLOBAL.debug_dbug= "+d,corrupt_queue_event,delay_semisync_kill_connection_for_mdev_28141";
|
||||
#--
|
||||
#-- Test begins
|
||||
connection server_1_con2;
|
||||
#-- Give enough time after timeout/ack received to query yes_tx/no_tx
|
||||
SET @@GLOBAL.debug_dbug= "+d,delay_shutdown_phase_2_after_semisync_wait";
|
||||
connection server_1;
|
||||
#-- Begin semi-sync transaction
|
||||
INSERT INTO t1 VALUES (1);
|
||||
connection server_1_con2;
|
||||
#-- Wait until master recognizes a connection is awaiting semi-sync ACK
|
||||
show status like 'Rpl_semi_sync_master_wait_sessions';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_wait_sessions 1
|
||||
#-- Give enough time after timeout/ack received to query yes_tx/no_tx
|
||||
SET @@GLOBAL.debug_dbug= "+d,delay_shutdown_phase_2_after_semisync_wait";
|
||||
#-- Begin master shutdown
|
||||
SHUTDOWN WAIT FOR ALL SLAVES;
|
||||
connection server_1;
|
||||
@@ -226,24 +219,33 @@ count(*)=0
|
||||
1
|
||||
#
|
||||
#-- Re-synchronize slaves with master and disable semi-sync
|
||||
#-- FIXME: workaround for MDEV-28141, preventing errored replicas from
|
||||
# killing their semi-sync connections
|
||||
connection server_2;
|
||||
set debug_sync= "now wait_for at_semisync_kill_connection";
|
||||
set debug_sync= "now signal continue_semisync_kill_connection";
|
||||
# Wait for debug_sync signal to have been received before issuing RESET
|
||||
set debug_sync= "reset";
|
||||
connection server_3;
|
||||
set debug_sync= "now wait_for at_semisync_kill_connection";
|
||||
set debug_sync= "now signal continue_semisync_kill_connection";
|
||||
# Wait for debug_sync signal to have been received before issuing RESET
|
||||
set debug_sync= "reset";
|
||||
#-- Stop slaves
|
||||
connection server_2;
|
||||
SET @@GLOBAL.debug_dbug= "";
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0;
|
||||
include/stop_slave.inc
|
||||
include/stop_slave_io.inc
|
||||
include/stop_slave_sql.inc
|
||||
SET @@GLOBAL.debug_dbug= @sav_server_2_dbug;
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_2;
|
||||
connection server_3;
|
||||
SET @@GLOBAL.debug_dbug= "";
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0;
|
||||
include/stop_slave.inc
|
||||
include/stop_slave_io.inc
|
||||
include/stop_slave_sql.inc
|
||||
SET @@GLOBAL.debug_dbug= @sav_server_3_dbug;
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_3;
|
||||
#-- Bring the master back up
|
||||
connection server_1_con2;
|
||||
connection default;
|
||||
connection server_1;
|
||||
SET @@GLOBAL.debug_dbug= "";
|
||||
SET @@GLOBAL.rpl_semi_sync_master_enabled = 0;
|
||||
show status like 'Rpl_semi_sync_master_status';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_status OFF
|
||||
TRUNCATE TABLE t1;
|
||||
#-- Bring slaves back up
|
||||
connection server_2;
|
||||
@@ -275,15 +277,15 @@ connection server_1;
|
||||
#-- Enable semi-sync on slaves
|
||||
let slave_last= 3
|
||||
connection server_2;
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
include/stop_slave.inc
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
include/start_slave.inc
|
||||
show status like 'Rpl_semi_sync_slave_status';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_slave_status ON
|
||||
connection server_3;
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
include/stop_slave.inc
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
include/start_slave.inc
|
||||
show status like 'Rpl_semi_sync_slave_status';
|
||||
Variable_name Value
|
||||
@@ -302,24 +304,20 @@ show status like 'Rpl_semi_sync_master_clients';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_clients 2
|
||||
#-- Prepare servers to simulate delay or error
|
||||
connection server_1;
|
||||
SET @@GLOBAL.debug_dbug= "+d,mysqld_delay_kill_threads_phase_1";
|
||||
connection server_2;
|
||||
SET @@GLOBAL.debug_dbug= "+d,corrupt_queue_event";
|
||||
SET @@GLOBAL.debug_dbug= "+d,corrupt_queue_event,delay_semisync_kill_connection_for_mdev_28141";
|
||||
connection server_3;
|
||||
SET @@GLOBAL.debug_dbug= "+d,simulate_delay_semisync_slave_reply";
|
||||
#--
|
||||
#-- Test begins
|
||||
connection server_1_con2;
|
||||
#-- Give enough time after timeout/ack received to query yes_tx/no_tx
|
||||
SET @@GLOBAL.debug_dbug= "+d,delay_shutdown_phase_2_after_semisync_wait";
|
||||
connection server_1;
|
||||
#-- Begin semi-sync transaction
|
||||
INSERT INTO t1 VALUES (1);
|
||||
connection server_1_con2;
|
||||
#-- Wait until master recognizes a connection is awaiting semi-sync ACK
|
||||
show status like 'Rpl_semi_sync_master_wait_sessions';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_wait_sessions 1
|
||||
#-- Give enough time after timeout/ack received to query yes_tx/no_tx
|
||||
SET @@GLOBAL.debug_dbug= "+d,delay_shutdown_phase_2_after_semisync_wait";
|
||||
#-- Begin master shutdown
|
||||
SHUTDOWN WAIT FOR ALL SLAVES;
|
||||
connection server_1;
|
||||
@@ -344,24 +342,28 @@ count(*)=1
|
||||
1
|
||||
#
|
||||
#-- Re-synchronize slaves with master and disable semi-sync
|
||||
#-- FIXME: workaround for MDEV-28141, preventing errored replicas from
|
||||
# killing their semi-sync connections
|
||||
connection server_2;
|
||||
set debug_sync= "now wait_for at_semisync_kill_connection";
|
||||
set debug_sync= "now signal continue_semisync_kill_connection";
|
||||
# Wait for debug_sync signal to have been received before issuing RESET
|
||||
set debug_sync= "reset";
|
||||
#-- Stop slaves
|
||||
connection server_2;
|
||||
SET @@GLOBAL.debug_dbug= "";
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0;
|
||||
include/stop_slave.inc
|
||||
include/stop_slave_io.inc
|
||||
include/stop_slave_sql.inc
|
||||
SET @@GLOBAL.debug_dbug= @sav_server_2_dbug;
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_2;
|
||||
connection server_3;
|
||||
SET @@GLOBAL.debug_dbug= "";
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0;
|
||||
include/stop_slave.inc
|
||||
include/stop_slave_io.inc
|
||||
include/stop_slave_sql.inc
|
||||
SET @@GLOBAL.debug_dbug= @sav_server_3_dbug;
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_3;
|
||||
#-- Bring the master back up
|
||||
connection server_1_con2;
|
||||
connection default;
|
||||
connection server_1;
|
||||
SET @@GLOBAL.debug_dbug= "";
|
||||
SET @@GLOBAL.rpl_semi_sync_master_enabled = 0;
|
||||
show status like 'Rpl_semi_sync_master_status';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_status OFF
|
||||
TRUNCATE TABLE t1;
|
||||
#-- Bring slaves back up
|
||||
connection server_2;
|
||||
@@ -399,15 +401,15 @@ connection server_1;
|
||||
#-- Enable semi-sync on slaves
|
||||
let slave_last= 3
|
||||
connection server_2;
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
include/stop_slave.inc
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
include/start_slave.inc
|
||||
show status like 'Rpl_semi_sync_slave_status';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_slave_status ON
|
||||
connection server_3;
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
include/stop_slave.inc
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
include/start_slave.inc
|
||||
show status like 'Rpl_semi_sync_slave_status';
|
||||
Variable_name Value
|
||||
@@ -426,24 +428,20 @@ show status like 'Rpl_semi_sync_master_clients';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_clients 2
|
||||
#-- Prepare servers to simulate delay or error
|
||||
connection server_1;
|
||||
SET @@GLOBAL.debug_dbug= "+d,mysqld_delay_kill_threads_phase_1";
|
||||
connection server_2;
|
||||
SET @@GLOBAL.debug_dbug= "+d,corrupt_queue_event,slave_delay_killing_semisync_connection";
|
||||
SET @@GLOBAL.debug_dbug= "+d,corrupt_queue_event,delay_semisync_kill_connection_for_mdev_28141";
|
||||
connection server_3;
|
||||
SET @@GLOBAL.debug_dbug= "+d,simulate_delay_semisync_slave_reply";
|
||||
#--
|
||||
#-- Test begins
|
||||
connection server_1_con2;
|
||||
#-- Give enough time after timeout/ack received to query yes_tx/no_tx
|
||||
SET @@GLOBAL.debug_dbug= "+d,delay_shutdown_phase_2_after_semisync_wait";
|
||||
connection server_1;
|
||||
#-- Begin semi-sync transaction
|
||||
INSERT INTO t1 VALUES (1);
|
||||
connection server_1_con2;
|
||||
#-- Wait until master recognizes a connection is awaiting semi-sync ACK
|
||||
show status like 'Rpl_semi_sync_master_wait_sessions';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_wait_sessions 1
|
||||
#-- Give enough time after timeout/ack received to query yes_tx/no_tx
|
||||
SET @@GLOBAL.debug_dbug= "+d,delay_shutdown_phase_2_after_semisync_wait";
|
||||
#-- Begin master shutdown
|
||||
SHUTDOWN WAIT FOR ALL SLAVES;
|
||||
connection server_1;
|
||||
@@ -468,24 +466,28 @@ count(*)=1
|
||||
1
|
||||
#
|
||||
#-- Re-synchronize slaves with master and disable semi-sync
|
||||
#-- FIXME: workaround for MDEV-28141, preventing errored replicas from
|
||||
# killing their semi-sync connections
|
||||
connection server_2;
|
||||
set debug_sync= "now wait_for at_semisync_kill_connection";
|
||||
set debug_sync= "now signal continue_semisync_kill_connection";
|
||||
# Wait for debug_sync signal to have been received before issuing RESET
|
||||
set debug_sync= "reset";
|
||||
#-- Stop slaves
|
||||
connection server_2;
|
||||
SET @@GLOBAL.debug_dbug= "";
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0;
|
||||
include/stop_slave.inc
|
||||
include/stop_slave_io.inc
|
||||
include/stop_slave_sql.inc
|
||||
SET @@GLOBAL.debug_dbug= @sav_server_2_dbug;
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_2;
|
||||
connection server_3;
|
||||
SET @@GLOBAL.debug_dbug= "";
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0;
|
||||
include/stop_slave.inc
|
||||
include/stop_slave_io.inc
|
||||
include/stop_slave_sql.inc
|
||||
SET @@GLOBAL.debug_dbug= @sav_server_3_dbug;
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_3;
|
||||
#-- Bring the master back up
|
||||
connection server_1_con2;
|
||||
connection default;
|
||||
connection server_1;
|
||||
SET @@GLOBAL.debug_dbug= "";
|
||||
SET @@GLOBAL.rpl_semi_sync_master_enabled = 0;
|
||||
show status like 'Rpl_semi_sync_master_status';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_status OFF
|
||||
TRUNCATE TABLE t1;
|
||||
#-- Bring slaves back up
|
||||
connection server_2;
|
||||
@@ -509,9 +511,13 @@ COUNT(*)=0
|
||||
#############################
|
||||
connection server_2;
|
||||
include/stop_slave.inc
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled = @sav_enabled_server_2;
|
||||
SET @@GLOBAL.debug_dbug= @sav_server_2_dbug;
|
||||
include/start_slave.inc
|
||||
connection server_3;
|
||||
include/stop_slave.inc
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled = @sav_enabled_server_3;
|
||||
SET @@GLOBAL.debug_dbug= @sav_server_3_dbug;
|
||||
include/start_slave.inc
|
||||
connection server_1;
|
||||
drop table t1;
|
||||
|
@@ -73,6 +73,9 @@
|
||||
# non-boolean value.
|
||||
#
|
||||
#
|
||||
# Additionally ensure MASTER_DEMOTE_TO_REPLICA aliases MASTER_DEMOTE_TO_SLAVE
|
||||
#
|
||||
#
|
||||
# References:
|
||||
# MDEV-19801: Change defaults for CHANGE MASTER TO so that GTID-based
|
||||
# replication is used by default if master supports it
|
||||
@@ -454,6 +457,37 @@ EOF
|
||||
--eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SLAVE_MYPORT, master_user='root', master_use_gtid=Slave_Pos, master_demote_to_slave=invalid
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-31768
|
||||
--echo # Ensure MASTER_DEMOTE_TO_REPLICA aliases MASTER_DEMOTE_TO_SLAVE
|
||||
--echo #
|
||||
--connection slave
|
||||
RESET MASTER;
|
||||
--source include/reset_slave.inc
|
||||
CREATE TABLE t_mdev_31768 (a int);
|
||||
--let $gtid_binlog_pos= `SELECT @@GLOBAL.gtid_binlog_pos`
|
||||
CHANGE MASTER TO master_use_gtid=Replica_Pos, master_demote_to_replica=1;
|
||||
--let $gtid_slave_pos= `SELECT @@GLOBAL.gtid_slave_pos`
|
||||
|
||||
--echo # Validating alias MASTER_DEMOTE_TO_REPLICA provides intended behavior..
|
||||
if (`SELECT strcmp("$gtid_binlog_pos","$gtid_slave_pos") != 0`)
|
||||
{
|
||||
--echo # ..failed
|
||||
--echo # Binlog pos: $gtid_binlog_pos
|
||||
--echo # Replica pos: $gtid_slave_pos
|
||||
die MASTER_DEMOTE_TO_REPLICA does not alias MASTER_DEMOTE_TO_SLAVE correctly;
|
||||
}
|
||||
--echo # ..success
|
||||
|
||||
DROP TABLE t_mdev_31768;
|
||||
RESET MASTER;
|
||||
--source include/reset_slave.inc
|
||||
|
||||
--echo # Clear primary binlog state to match replica
|
||||
--connection master
|
||||
RESET MASTER;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Cleanup
|
||||
--echo #
|
||||
|
@@ -9,6 +9,7 @@ CREATE TABLE t1(i INT) ENGINE=INNODB;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
SELECT * FROM t1;
|
||||
sync_slave_with_master;
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
connection slave;
|
||||
|
||||
@@ -28,7 +29,7 @@ let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Igno
|
||||
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
|
||||
--source include/start_slave.inc
|
||||
sync_with_master;
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
let $do_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
|
||||
let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
|
||||
@@ -44,7 +45,7 @@ START TRANSACTION;
|
||||
INSERT INTO t1 VALUES(2);
|
||||
INSERT INTO t1 VALUES(3);
|
||||
COMMIT;
|
||||
save_master_pos;
|
||||
--source include/save_master_gtid.inc
|
||||
SELECT * FROM t1;
|
||||
|
||||
connection slave;
|
||||
@@ -55,7 +56,7 @@ SET @@global.debug_dbug=@saved_dbug;
|
||||
|
||||
START SLAVE io_thread;
|
||||
--source include/wait_for_slave_io_to_start.inc
|
||||
sync_with_master;
|
||||
--source include/sync_with_master_gtid.inc
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo # Case 1 : Start slave with IGNORE_DOMAIN_IDS=(1), then restart
|
||||
@@ -70,7 +71,7 @@ let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Igno
|
||||
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
|
||||
--source include/start_slave.inc
|
||||
sync_with_master;
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
let $do_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
|
||||
let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
|
||||
@@ -86,7 +87,7 @@ INSERT INTO t1 VALUES(4);
|
||||
INSERT INTO t1 VALUES(5);
|
||||
COMMIT;
|
||||
|
||||
save_master_pos;
|
||||
--source include/save_master_gtid.inc
|
||||
SELECT * FROM t1;
|
||||
|
||||
connection slave;
|
||||
@@ -97,7 +98,7 @@ SET @@global.debug_dbug=@saved_dbug;
|
||||
|
||||
START SLAVE io_thread;
|
||||
--source include/wait_for_slave_io_to_start.inc
|
||||
sync_with_master;
|
||||
--source include/sync_with_master_gtid.inc
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo # Case 2 : Start slave with IGNORE_DOMAIN_IDS=(), then restart
|
||||
@@ -112,7 +113,7 @@ let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Igno
|
||||
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
|
||||
--source include/start_slave.inc
|
||||
sync_with_master;
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
let $do_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
|
||||
let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
|
||||
@@ -140,7 +141,7 @@ INSERT INTO t1 VALUES(10);
|
||||
INSERT INTO t1 VALUES(11);
|
||||
COMMIT;
|
||||
|
||||
save_master_pos;
|
||||
--source include/save_master_gtid.inc
|
||||
SELECT * FROM t1;
|
||||
|
||||
connection slave;
|
||||
@@ -157,7 +158,7 @@ let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Igno
|
||||
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
|
||||
--source include/start_slave.inc
|
||||
sync_with_master;
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
let $do_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
|
||||
let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
|
||||
@@ -178,7 +179,7 @@ let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Igno
|
||||
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
|
||||
--source include/start_slave.inc
|
||||
sync_with_master;
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
let $do_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
|
||||
let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
|
||||
@@ -196,6 +197,15 @@ INSERT INTO t1 VALUES(12);
|
||||
INSERT INTO t1 VALUES(13);
|
||||
COMMIT; # IO thread gets killed here.
|
||||
|
||||
# MDEV-14357
|
||||
# As the prior transaction will be ignored on slave because its domain id is
|
||||
# ignored, the replica's gtid_slave_pos will be updated to have seen it,
|
||||
# despite its eventual failure to queue the whole transaction to the relay log.
|
||||
# So for test consistency, we need to synchronize the SQL thread with this
|
||||
# position; otherwise, when restarting the server after resetting
|
||||
# IGNORE_DOMAIN_IDS, we will re-fetch this event and execute it.
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 VALUES(14);
|
||||
INSERT INTO t1 VALUES(15);
|
||||
@@ -207,7 +217,6 @@ INSERT INTO t1 VALUES(16);
|
||||
INSERT INTO t1 VALUES(17);
|
||||
COMMIT;
|
||||
|
||||
save_master_pos;
|
||||
SELECT * FROM t1;
|
||||
|
||||
connection slave;
|
||||
@@ -217,6 +226,11 @@ SELECT * FROM t1;
|
||||
|
||||
SET @@global.debug_dbug=@saved_dbug;
|
||||
|
||||
# MDEV-14357
|
||||
# Ensure the SQL thread is updated with the GTID of the ignored transaction
|
||||
# so we don't fetch it and execute it after restarting without any ignored
|
||||
# domain ids.
|
||||
--source include/sync_with_master_gtid.inc
|
||||
--source include/stop_slave_sql.inc
|
||||
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
|
||||
let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
|
||||
@@ -224,8 +238,12 @@ let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Igno
|
||||
--echo IGNORE_DOMAIN_IDS (BEFORE) : $ignore_domain_ids_before
|
||||
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
|
||||
|
||||
--connection master
|
||||
--source include/save_master_gtid.inc
|
||||
--connection slave
|
||||
--source include/start_slave.inc
|
||||
sync_with_master;
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
let $do_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
|
||||
let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
|
||||
@@ -246,7 +264,7 @@ let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Igno
|
||||
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
|
||||
--source include/start_slave.inc
|
||||
sync_with_master;
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
let $do_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
|
||||
let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
|
||||
@@ -264,6 +282,11 @@ INSERT INTO t1 VALUES(18);
|
||||
INSERT INTO t1 VALUES(19); # IO thread gets killed here.
|
||||
COMMIT;
|
||||
|
||||
# MDEV-14357
|
||||
# Synchronize gtid_slave_pos with the ignored event. See prior comments about
|
||||
# MDEV-14357 for details.
|
||||
--source include/save_master_gtid.inc
|
||||
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 VALUES(20);
|
||||
INSERT INTO t1 VALUES(21);
|
||||
@@ -275,7 +298,6 @@ INSERT INTO t1 VALUES(22);
|
||||
INSERT INTO t1 VALUES(23);
|
||||
COMMIT;
|
||||
|
||||
save_master_pos;
|
||||
SELECT * FROM t1;
|
||||
|
||||
connection slave;
|
||||
@@ -285,6 +307,10 @@ SELECT * FROM t1;
|
||||
|
||||
SET @@global.debug_dbug=@saved_dbug;
|
||||
|
||||
# MDEV-14357
|
||||
# Synchronize gtid_slave_pos with the ignored event. See prior comments about
|
||||
# MDEV-14357 for details.
|
||||
--source include/sync_with_master_gtid.inc
|
||||
--source include/stop_slave_sql.inc
|
||||
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
|
||||
let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
|
||||
@@ -292,8 +318,12 @@ let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Igno
|
||||
--echo IGNORE_DOMAIN_IDS (BEFORE) : $ignore_domain_ids_before
|
||||
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
|
||||
|
||||
--connection master
|
||||
--source include/save_master_gtid.inc
|
||||
--connection slave
|
||||
--source include/start_slave.inc
|
||||
sync_with_master;
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
let $do_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
|
||||
let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
|
||||
@@ -314,7 +344,7 @@ let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Igno
|
||||
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
|
||||
--source include/start_slave.inc
|
||||
sync_with_master;
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
let $do_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
|
||||
let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
|
||||
@@ -343,7 +373,7 @@ INSERT INTO t1 VALUES(28);
|
||||
INSERT INTO t1 VALUES(29);
|
||||
COMMIT;
|
||||
|
||||
save_master_pos;
|
||||
--source include/save_master_gtid.inc
|
||||
SELECT * FROM t1;
|
||||
|
||||
connection slave;
|
||||
@@ -361,7 +391,7 @@ let $ignore_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Igno
|
||||
|
||||
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
|
||||
--source include/start_slave.inc
|
||||
sync_with_master;
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
let $do_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
|
||||
let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
|
||||
|
@@ -3,7 +3,6 @@
|
||||
# replicas before shutting down.
|
||||
#
|
||||
# Parameters:
|
||||
# server_1_dbug (string) Debug setting for primary (server 1)
|
||||
# server_2_dbug (string) Debug setting to simulate delay or error on
|
||||
# the first replica (server 2)
|
||||
# server_3_dbug (string) Debug setting to simulate delay or error on
|
||||
@@ -32,8 +31,8 @@ while (`SELECT $i <= $slave_last`)
|
||||
--connection server_$i
|
||||
--sync_with_master
|
||||
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
source include/stop_slave.inc;
|
||||
set global rpl_semi_sync_slave_enabled = 1;
|
||||
source include/start_slave.inc;
|
||||
show status like 'Rpl_semi_sync_slave_status';
|
||||
|
||||
@@ -56,8 +55,6 @@ show status like 'Rpl_semi_sync_master_status';
|
||||
show status like 'Rpl_semi_sync_master_clients';
|
||||
|
||||
--echo #-- Prepare servers to simulate delay or error
|
||||
--connection server_1
|
||||
--eval SET @@GLOBAL.debug_dbug= $server_1_dbug
|
||||
--connection server_2
|
||||
--eval SET @@GLOBAL.debug_dbug= $server_2_dbug
|
||||
--connection server_3
|
||||
@@ -66,6 +63,14 @@ show status like 'Rpl_semi_sync_master_clients';
|
||||
--echo #--
|
||||
--echo #-- Test begins
|
||||
|
||||
--connection server_1_con2
|
||||
--echo #-- Give enough time after timeout/ack received to query yes_tx/no_tx
|
||||
SET @@GLOBAL.debug_dbug= "+d,delay_shutdown_phase_2_after_semisync_wait";
|
||||
|
||||
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
wait
|
||||
EOF
|
||||
|
||||
--connection server_1
|
||||
--echo #-- Begin semi-sync transaction
|
||||
--send INSERT INTO t1 VALUES (1)
|
||||
@@ -75,14 +80,6 @@ show status like 'Rpl_semi_sync_master_clients';
|
||||
let $status_var= Rpl_semi_sync_master_wait_sessions;
|
||||
let $status_var_value= 1;
|
||||
source include/wait_for_status_var.inc;
|
||||
show status like 'Rpl_semi_sync_master_wait_sessions';
|
||||
|
||||
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
wait
|
||||
EOF
|
||||
|
||||
--echo #-- Give enough time after timeout/ack received to query yes_tx/no_tx
|
||||
SET @@GLOBAL.debug_dbug= "+d,delay_shutdown_phase_2_after_semisync_wait";
|
||||
|
||||
--echo #-- Begin master shutdown
|
||||
--send SHUTDOWN WAIT FOR ALL SLAVES
|
||||
@@ -111,19 +108,72 @@ show status like 'Rpl_semi_sync_master_no_tx';
|
||||
--echo #
|
||||
--echo #-- Re-synchronize slaves with master and disable semi-sync
|
||||
|
||||
if (`SELECT ($server_2_expect_row_count + $server_3_expect_row_count) < 2`)
|
||||
{
|
||||
--echo #-- FIXME: workaround for MDEV-28141, preventing errored replicas from
|
||||
--echo # killing their semi-sync connections
|
||||
# I.e. we can't create a new kill connection to the primary if we know that the
|
||||
# primary is shutting down for risk of Packets out of order error. So we wait
|
||||
# to hit a debug_sync point before the creation of the new kill_connection, and
|
||||
# don't progress until the primary has been shutdown, so no new connection can
|
||||
# be formed.
|
||||
# Note this is only needed in the error case (using corrupt_queue_event), as
|
||||
# the running io_thread will otherwise automatically detect that the primary
|
||||
# has shutdown before progressing to the cleanup of the io thread.
|
||||
}
|
||||
|
||||
if (!$server_2_expect_row_count)
|
||||
{
|
||||
--connection server_2
|
||||
set debug_sync= "now wait_for at_semisync_kill_connection";
|
||||
set debug_sync= "now signal continue_semisync_kill_connection";
|
||||
--echo # Wait for debug_sync signal to have been received before issuing RESET
|
||||
let $wait_condition= select count(*)=0 from information_schema.processlist where state like "debug sync point%";
|
||||
source include/wait_condition.inc;
|
||||
set debug_sync= "reset";
|
||||
}
|
||||
if (!$server_3_expect_row_count)
|
||||
{
|
||||
--connection server_3
|
||||
set debug_sync= "now wait_for at_semisync_kill_connection";
|
||||
set debug_sync= "now signal continue_semisync_kill_connection";
|
||||
--echo # Wait for debug_sync signal to have been received before issuing RESET
|
||||
let $wait_condition= select count(*)=0 from information_schema.processlist where state like "debug sync point%";
|
||||
source include/wait_condition.inc;
|
||||
set debug_sync= "reset";
|
||||
}
|
||||
|
||||
--echo #-- Stop slaves
|
||||
|
||||
--connection server_2
|
||||
--eval SET @@GLOBAL.debug_dbug= "$sav_server_2_dbug"
|
||||
--eval SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0
|
||||
--let $rpl_only_running_threads= 1
|
||||
source include/stop_slave.inc;
|
||||
# If server_2_expect_row_count is 0, we are simulating an error on the replica
|
||||
# and the IO thread will end with errno 1595.
|
||||
# Otherwise, we still expect error, because the master has shutdown at this
|
||||
# point, and the IO thread may or may not have realized the shutdown, and
|
||||
# started to try to automatically reconnect. This may result in the IO thread
|
||||
# giving a 2003 error if the slave tries to reconnect to a shutdown master.
|
||||
# Additionally disable warnings because the slave may have stopped in err
|
||||
# automatically, and we don't want a sporadic "Slave is already stopped"
|
||||
# warning.
|
||||
--disable_warnings
|
||||
--let $rpl_allow_error= 1
|
||||
--source include/stop_slave_io.inc
|
||||
--enable_warnings
|
||||
--let $rpl_allow_error=
|
||||
--source include/stop_slave_sql.inc
|
||||
SET @@GLOBAL.debug_dbug= @sav_server_2_dbug;
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_2;
|
||||
|
||||
--connection server_3
|
||||
--eval SET @@GLOBAL.debug_dbug= "$sav_server_3_dbug"
|
||||
--eval SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0
|
||||
--let $rpl_only_running_threads= 1
|
||||
source include/stop_slave.inc;
|
||||
# Expect error for IO thread, see above comment for stopping server_2
|
||||
--disable_warnings
|
||||
--let $rpl_allow_error= 1
|
||||
--source include/stop_slave_io.inc
|
||||
--enable_warnings
|
||||
--let $rpl_allow_error=
|
||||
--source include/stop_slave_sql.inc
|
||||
SET @@GLOBAL.debug_dbug= @sav_server_3_dbug;
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_3;
|
||||
|
||||
--echo #-- Bring the master back up
|
||||
--connection server_1_con2
|
||||
@@ -142,13 +192,6 @@ EOF
|
||||
--enable_reconnect
|
||||
--source include/wait_until_connected_again.inc
|
||||
|
||||
--eval SET @@GLOBAL.debug_dbug= "$sav_master_dbug"
|
||||
let $status_var= Rpl_semi_sync_master_clients;
|
||||
let $status_var_value= 0;
|
||||
source include/wait_for_status_var.inc;
|
||||
--eval SET @@GLOBAL.rpl_semi_sync_master_enabled = 0
|
||||
show status like 'Rpl_semi_sync_master_status';
|
||||
|
||||
TRUNCATE TABLE t1;
|
||||
--save_master_pos
|
||||
|
||||
|
@@ -69,9 +69,8 @@ call mtr.add_suppression("Timeout waiting");
|
||||
call mtr.add_suppression("did not exit");
|
||||
call mtr.add_suppression("Got an error reading communication packets");
|
||||
|
||||
--let $sav_master_timeout= `SELECT @@global.rpl_semi_sync_master_timeout`
|
||||
--let $sav_master_timeout= `SELECT @@GLOBAL.rpl_semi_sync_master_timeout`
|
||||
--let $sav_enabled_master= `SELECT @@GLOBAL.rpl_semi_sync_master_enabled`
|
||||
--let $sav_master_dbug= `SELECT @@GLOBAL.debug_dbug`
|
||||
|
||||
--echo # Suppress slave errors related to the simulated error
|
||||
--connection server_2
|
||||
@@ -79,16 +78,16 @@ call mtr.add_suppression("reply failed");
|
||||
call mtr.add_suppression("Replication event checksum verification");
|
||||
call mtr.add_suppression("Relay log write failure");
|
||||
call mtr.add_suppression("Failed to kill the active semi-sync connection");
|
||||
--let $sav_enabled_server_2=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled`
|
||||
--let $sav_server_2_dbug= `SELECT @@GLOBAL.debug_dbug`
|
||||
set @sav_enabled_server_2= @@GLOBAL.rpl_semi_sync_slave_enabled;
|
||||
set @sav_server_2_dbug= @@GLOBAL.debug_dbug;
|
||||
|
||||
--connection server_3
|
||||
call mtr.add_suppression("reply failed");
|
||||
call mtr.add_suppression("Replication event checksum verification");
|
||||
call mtr.add_suppression("Relay log write failure");
|
||||
call mtr.add_suppression("Failed to kill the active semi-sync connection");
|
||||
--let $sav_enabled_server_3=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled`
|
||||
--let $sav_server_3_dbug= `SELECT @@GLOBAL.debug_dbug`
|
||||
set @sav_enabled_server_3= @@GLOBAL.rpl_semi_sync_slave_enabled;
|
||||
set @sav_server_3_dbug= @@GLOBAL.debug_dbug;
|
||||
|
||||
--connection server_1
|
||||
CREATE TABLE t1 (a int);
|
||||
@@ -116,7 +115,6 @@ while (`SELECT $i <= $slave_last`)
|
||||
--echo # allowed timeout, the primary should delay killing the suspended thread
|
||||
--echo # until an ACK is received (Rpl_semi_sync_master_yes_tx should be 1).
|
||||
--echo #
|
||||
--let server_1_dbug= ""
|
||||
--let server_2_dbug= "+d,simulate_delay_semisync_slave_reply"
|
||||
--let server_3_dbug= "+d,simulate_delay_semisync_slave_reply"
|
||||
--let semisync_timeout= 1600
|
||||
@@ -129,9 +127,8 @@ while (`SELECT $i <= $slave_last`)
|
||||
--echo # the primary should delay killing the suspended thread until the
|
||||
--echo # timeout is reached (Rpl_semi_sync_master_no_tx should be 1).
|
||||
--echo #
|
||||
--let server_1_dbug= "+d,mysqld_delay_kill_threads_phase_1"
|
||||
--let server_2_dbug= "+d,corrupt_queue_event"
|
||||
--let server_3_dbug= "+d,corrupt_queue_event"
|
||||
--let server_2_dbug= "+d,corrupt_queue_event,delay_semisync_kill_connection_for_mdev_28141"
|
||||
--let server_3_dbug= "+d,corrupt_queue_event,delay_semisync_kill_connection_for_mdev_28141"
|
||||
--let semisync_timeout= 500
|
||||
--let server_2_expect_row_count= 0
|
||||
--let server_3_expect_row_count= 0
|
||||
@@ -143,8 +140,7 @@ while (`SELECT $i <= $slave_last`)
|
||||
--echo # primary should delay killing the suspended thread until it receives an
|
||||
--echo # ACK from the delayed slave (Rpl_semi_sync_master_yes_tx should be 1).
|
||||
--echo #
|
||||
--let server_1_dbug= "+d,mysqld_delay_kill_threads_phase_1"
|
||||
--let server_2_dbug= "+d,corrupt_queue_event"
|
||||
--let server_2_dbug= "+d,corrupt_queue_event,delay_semisync_kill_connection_for_mdev_28141"
|
||||
--let server_3_dbug= "+d,simulate_delay_semisync_slave_reply"
|
||||
--let semisync_timeout= 1600
|
||||
--let server_2_expect_row_count= 0
|
||||
@@ -163,15 +159,7 @@ while (`SELECT $i <= $slave_last`)
|
||||
--echo # slave does not send a `QUIT` in this case (Rpl_semi_sync_master_yes_tx
|
||||
--echo # should be 1 because server_3 will send the ACK within a valid timeout).
|
||||
--echo #
|
||||
|
||||
# mysqld_delay_kill_threads_phase1 ensures that server_2 will have enough time
|
||||
# to start a new connection that has the intent to kill the active semi-sync
|
||||
# connection
|
||||
--let server_1_dbug= "+d,mysqld_delay_kill_threads_phase_1"
|
||||
|
||||
# slave_delay_killing_semisync_connection ensures that the primary has force
|
||||
# killed its current connection before it is able to issue `KILL`
|
||||
--let server_2_dbug= "+d,corrupt_queue_event,slave_delay_killing_semisync_connection"
|
||||
--let server_2_dbug= "+d,corrupt_queue_event,delay_semisync_kill_connection_for_mdev_28141"
|
||||
--let server_3_dbug= "+d,simulate_delay_semisync_slave_reply"
|
||||
--let semisync_timeout= 1600
|
||||
--let server_2_expect_row_count= 0
|
||||
@@ -184,32 +172,24 @@ while (`SELECT $i <= $slave_last`)
|
||||
|
||||
--connection server_2
|
||||
source include/stop_slave.inc;
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled = @sav_enabled_server_2;
|
||||
SET @@GLOBAL.debug_dbug= @sav_server_2_dbug;
|
||||
source include/start_slave.inc;
|
||||
|
||||
--disable_query_log
|
||||
--eval SET @@GLOBAL.rpl_semi_sync_slave_enabled = $sav_enabled_server_2
|
||||
--eval SET @@GLOBAL.debug_dbug= "$sav_server_2_dbug"
|
||||
--enable_query_log
|
||||
|
||||
--connection server_3
|
||||
source include/stop_slave.inc;
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled = @sav_enabled_server_3;
|
||||
SET @@GLOBAL.debug_dbug= @sav_server_3_dbug;
|
||||
source include/start_slave.inc;
|
||||
|
||||
--disable_query_log
|
||||
--eval SET @@GLOBAL.rpl_semi_sync_slave_enabled = $sav_enabled_server_3
|
||||
--eval SET @@GLOBAL.debug_dbug= "$sav_server_3_dbug"
|
||||
--enable_query_log
|
||||
|
||||
|
||||
--connection server_1
|
||||
let $status_var= Rpl_semi_sync_master_clients;
|
||||
let $status_var_value= 0;
|
||||
source include/wait_for_status_var.inc;
|
||||
|
||||
--disable_query_log
|
||||
--eval SET @@GLOBAL.rpl_semi_sync_master_timeout= $sav_master_timeout
|
||||
--eval SET @@GLOBAL.rpl_semi_sync_master_enabled= $sav_enabled_master
|
||||
--eval SET @@GLOBAL.debug_dbug= "$sav_master_dbug"
|
||||
--eval SET @@GLOBAL.rpl_semi_sync_master_timeout= $sav_master_timeout;
|
||||
--eval SET @@GLOBAL.rpl_semi_sync_master_enabled= $sav_enabled_master;
|
||||
--enable_query_log
|
||||
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user