diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result b/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result index 233f4acbcc0..5db6770d809 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result @@ -16,12 +16,25 @@ 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; -call mtr.add_suppression("Can.t init tc log"); -call mtr.add_suppression("Aborting"); -call mtr.add_suppression("1 client is using or hasn.t closed the table properly"); -call mtr.add_suppression("Table './mtr/test_suppressions' is marked as crashed and should be repaired"); CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; INSERT INTO t1 VALUES (1, 'dummy1'); +connection server_2; +connection server_1; +# +# Case:1 +# +# CRASH the original master, and FAILOVER to the new +# INSERT INTO t1 VALUES (2, REPEAT("x", 4100)) +# Row - 2 will be in master's binlog but not committed, gets replicated +# to slave and applied. On crash master should have 1 row and slave +# should have 2 rows. +# +# Expected State post crash: +#================================================================= +# Master | Slave | +# 0-1-4 (Not committed) | 0-1-4 (Received through semi-sync | +# | replication and applied) | +#================================================================= connect conn_client,127.0.0.1,root,,test,$SERVER_MYPORT_1,; SET DEBUG_SYNC= "commit_after_release_LOCK_after_binlog_sync SIGNAL con1_ready WAIT_FOR con1_go"; INSERT INTO t1 VALUES (2, REPEAT("x", 4100)); @@ -29,12 +42,15 @@ connection server_1; SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; # Kill the server connection server_2; +include/wait_for_slave_param.inc [Slave_SQL_Running_State] include/stop_slave.inc +include/assert.inc [Table t1 should have 2 rows.] SELECT @@GLOBAL.gtid_current_pos; @@GLOBAL.gtid_current_pos -0-1-8 -# restart: --rpl-semi-sync-slave-enabled=1 +0-1-4 +# restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 connection server_1; +include/assert.inc [Table t1 should have 1 rows.] FOUND 1 /truncated binlog file:.*master.*000001/ in mysqld.1.err disconnect conn_client; connection server_2; @@ -45,12 +61,18 @@ CHANGE MASTER TO master_host='127.0.0.1', master_port=$new_master_port, master_u set global rpl_semi_sync_slave_enabled = 1; set @@global.gtid_slave_pos=@@global.gtid_binlog_pos; include/start_slave.inc +# +# Server_2 promoted as master will send 0-1-4 to new slave Server_1 +# connection server_2; INSERT INTO t1 VALUES (3, 'dummy3'); # The gtid state on current master must be equal to ... SHOW VARIABLES LIKE 'gtid_binlog_pos'; Variable_name Value -gtid_binlog_pos 0-2-9 +gtid_binlog_pos 0-2-5 +SHOW VARIABLES LIKE 'gtid_slave_pos'; +Variable_name Value +gtid_slave_pos 0-1-4 connection server_1; SELECT COUNT(*) = 3 as 'true' FROM t1; true @@ -58,29 +80,50 @@ true # ... the gtid states on the slave: SHOW VARIABLES LIKE 'gtid_slave_pos'; Variable_name Value -gtid_slave_pos 0-2-9 +gtid_slave_pos 0-2-5 SHOW VARIABLES LIKE 'gtid_binlog_pos'; Variable_name Value -gtid_binlog_pos 0-2-9 +gtid_binlog_pos 0-2-5 connection server_2; +# +# Case:2 +# +# CRASH the new master, and FAILOVER back to the original +# INSERT INTO t1 VALUES (4, REPEAT("x", 4100)) +# INSERT INTO t1 VALUES (5, REPEAT("x", 4100)) +# Rows 4 and 5 will be in master's binlog but not committed, they get +# replicated to slave and applied. On crash master should have 3 rows +# and slave should have 5 rows. +# +# Expected State post crash: +#================================================================= +# Master | Slave | +# 0-2-6 (Not commited) | 0-2-6 (Received through semi-sync | +# | replication and applied) | +# 0-2-7 (Not commited) | 0-2-7 (Received through semi-sync | +# | replication and applied) | +#================================================================= connect conn_client,127.0.0.1,root,,test,$SERVER_MYPORT_2,; -SET DEBUG_SYNC= "commit_after_release_LOCK_after_binlog_sync SIGNAL con1_ready WAIT_FOR con1_go"; +SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go"; INSERT INTO t1 VALUES (4, REPEAT("x", 4100)); connect conn_client_2,127.0.0.1,root,,test,$SERVER_MYPORT_2,; SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; -SET DEBUG_SYNC= "commit_after_release_LOCK_log SIGNAL con1_ready WAIT_FOR con2_go"; +SET GLOBAL debug_dbug="d,Notify_binlog_EOF"; INSERT INTO t1 VALUES (5, REPEAT("x", 4100)); connection server_2; -SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; +SET DEBUG_SYNC= "now WAIT_FOR eof_reached"; # Kill the server connection server_1; +include/wait_for_slave_param.inc [Slave_SQL_Running_State] include/stop_slave.inc +include/assert.inc [Table t1 should have 5 rows.] SELECT @@GLOBAL.gtid_current_pos; @@GLOBAL.gtid_current_pos -0-2-11 -# restart: --rpl-semi-sync-slave-enabled=1 +0-2-7 +# restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 connection server_2; -NOT FOUND /truncated binlog file:.*slave.*000001/ in mysqld.2.err +include/assert.inc [Table t1 should have 3 rows.] +FOUND 1 /truncated binlog file:.*slave.*000002/ in mysqld.2.err disconnect conn_client; connection server_1; set global rpl_semi_sync_master_enabled = 1; @@ -90,12 +133,18 @@ CHANGE MASTER TO master_host='127.0.0.1', master_port=$new_master_port, master_u set global rpl_semi_sync_slave_enabled = 1; set @@global.gtid_slave_pos=@@global.gtid_binlog_pos; include/start_slave.inc +# +# Server_1 promoted as master will send 0-2-6 and 0-2-7 to slave Server_2 +# connection server_1; -INSERT INTO t1 VALUES (6, 'Done'); +INSERT INTO t1 VALUES (6, 'dummy6'); # The gtid state on current master must be equal to ... SHOW VARIABLES LIKE 'gtid_binlog_pos'; Variable_name Value -gtid_binlog_pos 0-1-12 +gtid_binlog_pos 0-1-8 +SHOW VARIABLES LIKE 'gtid_slave_pos'; +Variable_name Value +gtid_slave_pos 0-2-7 connection server_2; SELECT COUNT(*) = 6 as 'true' FROM t1; true @@ -103,27 +152,104 @@ true # ... the gtid states on the slave: SHOW VARIABLES LIKE 'gtid_slave_pos'; Variable_name Value -gtid_slave_pos 0-1-12 +gtid_slave_pos 0-1-8 SHOW VARIABLES LIKE 'gtid_binlog_pos'; Variable_name Value -gtid_binlog_pos 0-1-12 +gtid_binlog_pos 0-1-8 include/diff_tables.inc [server_1:t1, server_2:t1] +connection server_1; +# +# Case:3 +# +# CRASH the master and FAILOVER to slave +# INSERT INTO t1 VALUES (7, REPEAT("x", 4100)) +# INSERT INTO t1 VALUES (8, REPEAT("x", 4100)) +# Rows 7 and 8 will be in master's binlog but not committed, only 7 +# gets replicated to slave and applied. On crash master should have 6 +# rows and slave should have 7 rows. +# +# Expected State post crash: +#================================================================= +# Master | Slave | +# 0-1-9 (Not commited) | 0-1-9 (Received through semi-sync | +# | replication and applied) | +# 0-1-10 (Not commited - | | +# never sent to slave) | | +#================================================================= +connect conn_client,127.0.0.1,root,,test,$SERVER_MYPORT_1,; +SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go"; +INSERT INTO t1 VALUES (7, REPEAT("x", 4100)); +connect conn_client_3,127.0.0.1,root,,test,$SERVER_MYPORT_1,; +SET DEBUG_SYNC= "commit_before_update_binlog_end_pos SIGNAL con3_ready WAIT_FOR con1_go"; +INSERT INTO t1 VALUES (8, REPEAT("x", 4100)); +connection server_1; +SET DEBUG_SYNC= "now WAIT_FOR con3_ready"; +# Kill the server +connection server_2; +include/wait_for_slave_param.inc [Slave_SQL_Running_State] +include/stop_slave.inc +include/assert.inc [Table t1 should have 7 rows.] +SELECT @@GLOBAL.gtid_current_pos; +@@GLOBAL.gtid_current_pos +0-1-9 +# restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 +connection server_1; +include/assert.inc [Table t1 should have 6 rows.] +NOT FOUND /truncated binlog file:.*master.*000003/ in mysqld.1.err +disconnect conn_client; +connection server_2; +set global rpl_semi_sync_master_enabled = 1; +set global rpl_semi_sync_master_wait_point=AFTER_SYNC; +connection server_1; +CHANGE MASTER TO master_host='127.0.0.1', master_port=$new_master_port, master_user='root', master_use_gtid=SLAVE_POS; +set global rpl_semi_sync_slave_enabled = 1; +set @@global.gtid_slave_pos=@@global.gtid_binlog_pos; +include/start_slave.inc +# +# Server_2 promoted as master will send 0-1-9 to slave Server_1 +# +connection server_2; +INSERT INTO t1 VALUES (8, 'Done'); +include/save_master_gtid.inc +# The gtid state on current master must be equal to ... +SHOW VARIABLES LIKE 'gtid_binlog_pos'; +Variable_name Value +gtid_binlog_pos 0-2-10 +SHOW VARIABLES LIKE 'gtid_slave_pos'; +Variable_name Value +gtid_slave_pos 0-1-9 +connection server_1; +include/sync_with_master_gtid.inc +SELECT COUNT(*) = 8 as 'true' FROM t1; +true +1 +# ... the gtid states on the slave: +SHOW VARIABLES LIKE 'gtid_slave_pos'; +Variable_name Value +gtid_slave_pos 0-2-10 +SHOW VARIABLES LIKE 'gtid_binlog_pos'; +Variable_name Value +gtid_binlog_pos 0-2-10 +# # Cleanup +# +include/stop_slave.inc +set global rpl_semi_sync_slave_enabled = 0; +set global rpl_semi_sync_master_enabled = 0; +set global rpl_semi_sync_master_wait_point=default; +RESET MASTER; +RESET SLAVE; +connection server_2; +RESET MASTER; +RESET SLAVE; +set @@global.rpl_semi_sync_master_enabled = 0; +set @@global.rpl_semi_sync_slave_enabled = 0; +set @@global.rpl_semi_sync_master_wait_point=default; +CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_use_gtid=SLAVE_POS; +set @@global.gtid_slave_pos=@@global.gtid_binlog_pos; +include/start_slave.inc connection server_1; DROP TABLE t1; connection server_2; -include/stop_slave.inc -connection server_1; -set @@global.rpl_semi_sync_master_enabled = 0; -set @@global.rpl_semi_sync_slave_enabled = 0; -set @@global.rpl_semi_sync_master_wait_point=default; -RESET SLAVE; -RESET MASTER; -connection server_2; -set @@global.rpl_semi_sync_master_enabled = 0; -set @@global.rpl_semi_sync_slave_enabled = 0; -set @@global.rpl_semi_sync_master_wait_point=default; -CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_use_gtid=no; -include/start_slave.inc connection default; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_crash.inc b/mysql-test/suite/rpl/t/rpl_semi_sync_crash.inc index 1f24c42f680..b354020f8b2 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_crash.inc +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_crash.inc @@ -20,36 +20,70 @@ if (!$failover_to_slave) # Hold insert after write to binlog and before "run_commit_ordered" in engine -SET DEBUG_SYNC= "commit_after_release_LOCK_after_binlog_sync SIGNAL con1_ready WAIT_FOR con1_go"; ---send_eval $query_to_crash + +if ($case == 1) +{ + SET DEBUG_SYNC= "commit_after_release_LOCK_after_binlog_sync SIGNAL con1_ready WAIT_FOR con1_go"; + --send_eval $query_to_crash + --connection server_$server_to_crash + SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; + --source include/kill_mysqld.inc +} # complicate recovery with an extra binlog file -if (!$failover_to_slave) +if ($case == 2) { + SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go"; + --send_eval $query_to_crash --connect (conn_client_2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) # use the same signal with $query_to_crash SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; - SET DEBUG_SYNC= "commit_after_release_LOCK_log SIGNAL con1_ready WAIT_FOR con2_go"; + SET GLOBAL debug_dbug="d,Notify_binlog_EOF"; --send_eval $query2_to_crash + --connection server_$server_to_crash + SET DEBUG_SYNC= "now WAIT_FOR eof_reached"; + --source include/kill_mysqld.inc } ---connection server_$server_to_crash -SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; ---source include/kill_mysqld.inc +# complicate recovery with an extra binlog file +if ($case == 3) +{ + SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go"; + --send_eval $query_to_crash + --connect (conn_client_3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) + # use the same signal with $query_to_crash + SET DEBUG_SYNC= "commit_before_update_binlog_end_pos SIGNAL con3_ready WAIT_FOR con1_go"; + --send_eval $query2_to_crash + --connection server_$server_to_crash + SET DEBUG_SYNC= "now WAIT_FOR con3_ready"; + --source include/kill_mysqld.inc +} --connection server_$server_to_promote +--let $slave_param= Slave_SQL_Running_State +--let $slave_param_value= Slave has read all relay log; waiting for more updates +source include/wait_for_slave_param.inc; + --error 2003 --source include/stop_slave.inc + +--let $assert_cond= COUNT(*) = $expected_rows_on_slave FROM t1 +--let $assert_text= Table t1 should have $expected_rows_on_slave rows. +--source include/assert.inc + SELECT @@GLOBAL.gtid_current_pos; ---let $restart_parameters=--rpl-semi-sync-slave-enabled=1 +--let $restart_parameters=--skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 --let $allow_rpl_inited=1 --source include/start_mysqld.inc - --connection server_$server_to_crash --enable_reconnect --source include/wait_until_connected_again.inc +--let $assert_cond= COUNT(*) = $expected_rows_on_master FROM t1 +--let $assert_text= Table t1 should have $expected_rows_on_master rows. +--source include/assert.inc + # Check error log for correct messages. let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.$server_to_crash.err; --let SEARCH_FILE=$log_error_ diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.cnf b/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.cnf index f8312bdc5b8..8c5e63624c8 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.cnf +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.cnf @@ -5,7 +5,9 @@ [mysqld.1] log-slave-updates gtid-strict-mode=1 +sync-binlog=1 [mysqld.2] log-slave-updates gtid-strict-mode=1 +sync-binlog=1 diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test b/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test index 2c38cf4da54..0505e88d758 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test @@ -1,27 +1,10 @@ -# ==== Purpose ==== -# -# Test verifies replication failover scenario. -# -# ==== Implementation ==== -# -# Steps: -# 0 - Having two servers 1 and 2 enable semi-sync replication with -# with the master wait 'after_sync'. -# 1 - Insert a row. While inserting second row simulate -# a server crash at once the transaction is written to binlog, flushed -# and synced but the binlog position is not updated. -# 2 - Post crash-recovery on the old master execute there CHANGE MASTER -# TO command to connect to server id 2. -# 3 - The old master new slave server 1 must connect to the new -# master server 2. -# 4 - repeat the above to crash the new master and restore in role the old one -# # ==== References ==== # # MDEV-21117: recovery for --rpl-semi-sync-slave-enabled server - +# --source include/have_innodb.inc +--source include/have_debug.inc --source include/have_debug_sync.inc --source include/have_binlog_format_row.inc --source include/master-slave.inc @@ -43,36 +26,53 @@ set @@global.gtid_slave_pos = ""; CHANGE MASTER TO master_use_gtid= slave_pos; --source 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; -call mtr.add_suppression("Can.t init tc log"); -call mtr.add_suppression("Aborting"); -call mtr.add_suppression("1 client is using or hasn.t closed the table properly"); -call mtr.add_suppression("Table './mtr/test_suppressions' is marked as crashed and should be repaired"); - CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; INSERT INTO t1 VALUES (1, 'dummy1'); +--save_master_pos -# -# CRASH the original master, and FAILOVER to the new -# +--connection server_2 +--sync_with_master +--connection server_1 +--let $case = 1 +--echo # +--echo # Case:$case +--echo # +--echo # CRASH the original master, and FAILOVER to the new # value 1 for server id 1 -> 2 failover --let $failover_to_slave=1 --let $query_to_crash= INSERT INTO t1 VALUES (2, REPEAT("x", 4100)) +--echo # $query_to_crash +--echo # Row - 2 will be in master's binlog but not committed, gets replicated +--echo # to slave and applied. On crash master should have 1 row and slave +--echo # should have 2 rows. +--echo # +--echo # Expected State post crash: +--echo #================================================================= +--echo # Master | Slave | +--echo # 0-1-4 (Not committed) | 0-1-4 (Received through semi-sync | +--echo # | replication and applied) | +--echo #================================================================= --let $log_search_pattern=truncated binlog file:.*master.*000001 +--let $expected_rows_on_master= 1 +--let $expected_rows_on_slave= 2 --source rpl_semi_sync_crash.inc +--echo # +--echo # Server_2 promoted as master will send 0-1-4 to new slave Server_1 +--echo # --connection server_2 --let $rows_so_far=3 --eval INSERT INTO t1 VALUES ($rows_so_far, 'dummy3') --save_master_pos --echo # The gtid state on current master must be equal to ... SHOW VARIABLES LIKE 'gtid_binlog_pos'; +SHOW VARIABLES LIKE 'gtid_slave_pos'; --connection server_1 --sync_with_master @@ -82,23 +82,44 @@ SHOW VARIABLES LIKE 'gtid_slave_pos'; SHOW VARIABLES LIKE 'gtid_binlog_pos'; --connection server_2 -# -# CRASH the new master and FAILOVER back to the original -# - +--let $case = 2 +--echo # +--echo # Case:$case +--echo # +--echo # CRASH the new master, and FAILOVER back to the original # value 0 for the reverse server id 2 -> 1 failover --let $failover_to_slave=0 --let $query_to_crash = INSERT INTO t1 VALUES (4, REPEAT("x", 4100)) --let $query2_to_crash= INSERT INTO t1 VALUES (5, REPEAT("x", 4100)) ---let $log_search_pattern=truncated binlog file:.*slave.*000001 +--echo # $query_to_crash +--echo # $query2_to_crash +--echo # Rows 4 and 5 will be in master's binlog but not committed, they get +--echo # replicated to slave and applied. On crash master should have 3 rows +--echo # and slave should have 5 rows. +--echo # +--echo # Expected State post crash: +--echo #================================================================= +--echo # Master | Slave | +--echo # 0-2-6 (Not commited) | 0-2-6 (Received through semi-sync | +--echo # | replication and applied) | +--echo # 0-2-7 (Not commited) | 0-2-7 (Received through semi-sync | +--echo # | replication and applied) | +--echo #================================================================= +--let $log_search_pattern=truncated binlog file:.*slave.*000002 +--let $expected_rows_on_master= 3 +--let $expected_rows_on_slave= 5 --source rpl_semi_sync_crash.inc +--echo # +--echo # Server_1 promoted as master will send 0-2-6 and 0-2-7 to slave Server_2 +--echo # --connection server_1 --let $rows_so_far=6 ---eval INSERT INTO t1 VALUES ($rows_so_far, 'Done') +--eval INSERT INTO t1 VALUES ($rows_so_far, 'dummy6') --save_master_pos --echo # The gtid state on current master must be equal to ... SHOW VARIABLES LIKE 'gtid_binlog_pos'; +SHOW VARIABLES LIKE 'gtid_slave_pos'; --connection server_2 --sync_with_master @@ -107,35 +128,82 @@ SHOW VARIABLES LIKE 'gtid_binlog_pos'; SHOW VARIABLES LIKE 'gtid_slave_pos'; SHOW VARIABLES LIKE 'gtid_binlog_pos'; - --let $diff_tables=server_1:t1, server_2:t1 --source include/diff_tables.inc -# +--connection server_1 +--let $case = 3 +--echo # +--echo # Case:$case +--echo # +--echo # CRASH the master and FAILOVER to slave +--let $failover_to_slave=1 +--let $query_to_crash = INSERT INTO t1 VALUES (7, REPEAT("x", 4100)) +--let $query2_to_crash= INSERT INTO t1 VALUES (8, REPEAT("x", 4100)) +--echo # $query_to_crash +--echo # $query2_to_crash +--echo # Rows 7 and 8 will be in master's binlog but not committed, only 7 +--echo # gets replicated to slave and applied. On crash master should have 6 +--echo # rows and slave should have 7 rows. +--echo # +--echo # Expected State post crash: +--echo #================================================================= +--echo # Master | Slave | +--echo # 0-1-9 (Not commited) | 0-1-9 (Received through semi-sync | +--echo # | replication and applied) | +--echo # 0-1-10 (Not commited - | | +--echo # never sent to slave) | | +--echo #================================================================= +--let $log_search_pattern=truncated binlog file:.*master.*000003 +--let $expected_rows_on_master= 6 +--let $expected_rows_on_slave= 7 +--source rpl_semi_sync_crash.inc + +--echo # +--echo # Server_2 promoted as master will send 0-1-9 to slave Server_1 +--echo # +--connection server_2 +--let $rows_so_far=8 +--eval INSERT INTO t1 VALUES ($rows_so_far, 'Done') +--source include/save_master_gtid.inc +--echo # The gtid state on current master must be equal to ... +SHOW VARIABLES LIKE 'gtid_binlog_pos'; +SHOW VARIABLES LIKE 'gtid_slave_pos'; + +--connection server_1 +--source include/sync_with_master_gtid.inc +--eval SELECT COUNT(*) = $rows_so_far as 'true' FROM t1 +--echo # ... the gtid states on the slave: +SHOW VARIABLES LIKE 'gtid_slave_pos'; +SHOW VARIABLES LIKE 'gtid_binlog_pos'; + +--echo # --echo # Cleanup -# +--echo # + +--source include/stop_slave.inc +set global rpl_semi_sync_slave_enabled = 0; +set global rpl_semi_sync_master_enabled = 0; +set global rpl_semi_sync_master_wait_point=default; +RESET MASTER; +RESET SLAVE; + +--connection server_2 +RESET MASTER; +RESET SLAVE; +set @@global.rpl_semi_sync_master_enabled = 0; +set @@global.rpl_semi_sync_slave_enabled = 0; +set @@global.rpl_semi_sync_master_wait_point=default; +evalp CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_use_gtid=SLAVE_POS; +set @@global.gtid_slave_pos=@@global.gtid_binlog_pos; +--source include/start_slave.inc + --connection server_1 DROP TABLE t1; --save_master_pos --connection server_2 --sync_with_master ---source include/stop_slave.inc - ---connection server_1 -set @@global.rpl_semi_sync_master_enabled = 0; -set @@global.rpl_semi_sync_slave_enabled = 0; -set @@global.rpl_semi_sync_master_wait_point=default; -RESET SLAVE; -RESET MASTER; - ---connection server_2 -set @@global.rpl_semi_sync_master_enabled = 0; -set @@global.rpl_semi_sync_slave_enabled = 0; -set @@global.rpl_semi_sync_master_wait_point=default; - -evalp CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_use_gtid=no; ---source include/start_slave.inc connection default; --enable_reconnect diff --git a/sql/log.cc b/sql/log.cc index 2ab5bc31cda..d228cf697dd 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -8316,6 +8316,7 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader) } else { + DEBUG_SYNC(leader->thd, "commit_before_update_binlog_end_pos"); bool any_error= false; mysql_mutex_assert_not_owner(&LOCK_prepare_ordered); diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 2cf91adeac4..b187c26eee7 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -2828,6 +2828,12 @@ static int send_one_binlog_file(binlog_send_info *info, */ if (send_events(info, log, linfo, end_pos)) return 1; + DBUG_EXECUTE_IF("Notify_binlog_EOF", + { + const char act[]= "now signal eof_reached"; + DBUG_ASSERT(!debug_sync_set_action(current_thd, + STRING_WITH_LEN(act))); + };); } return 1;