1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
# ==== Purpose ====
#
# The purpose of this test is to test semi-synchronous replication in case the
# replication_sender_observe_commit_only=ON on the source
# and replication is running in the GTID mode.
#
# ==== Implementation ====
#
# 1) Set-up semi sync replication environment and ensure that
# replication_sender_observe_commit_only=ON on the source
# 2) Prepare a testing environment and execute statements in the background
# 3) Issue replica restart while source is running statements
# 4) Sanity check - check whether semi-sync replication was correctly restarted
# 5) Wait for source to finish the execution of statements
# 6) Wait for replica to catch-up with latest changes
# 7) Check whether the replica replicated table correctly
# 8) Clean up
#
# ==== Requirements ====
#
# The replica should be able to restart its connection while semi-synchronous
# replication is set-up in the GTID mode, and the
# replication_sender_observe_commit_only=ON on the source.
#
# ==== References ====
#
# Bug#33534218: replication_sender_observe_commit_only=ON leads to break
# semisync replication
--source include/have_binlog_format_row.inc
--echo # 1. Set-up semi sync replication environment
--echo # a) Setup a 2 layered topology with the given topology 1->2
--let $rpl_topology = 1->2
--source include/rpl_init.inc
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--eval SET GLOBAL replication_sender_observe_commit_only = 1
--eval SET GLOBAL replication_optimize_for_static_plugin_config = 1
CALL mtr.add_suppression("Semi-sync source failed on net_flush.*");
CALL mtr.add_suppression("Read semi-sync reply magic number error.*");
CALL mtr.add_suppression("A message intended for a client cannot be sent there as no client-session is attached.*");
CALL mtr.add_suppression("Timeout waiting for reply of binlog.*");
--source include/install_semisync_source.inc
--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
--source include/install_semisync_replica.inc
CALL mtr.add_suppression("The replica coordinator and worker threads are stopped.*");
--echo # b) Ensure that replication_sender_observe_commit_only is turned on
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--let $current_observe_commit_only= `SELECT @@GLOBAL.replication_sender_observe_commit_only`
--echo # replication_sender_observe_commit_only: $current_observe_commit_only
--let $assert_text= replication_sender_observe_commit_only should be ON (source)
--let $assert_variable_name= replication_sender_observe_commit_only
--let $assert_variable_value= 1
--source include/assert_variable.inc
--echo # 2. Prepare a testing environment and execute statements in the background
CREATE TABLE t (a int);
--let $iters = 500
--exec_in_background $MYSQL_SLAP --create-schema=test --delimiter=";" --iterations=$iters --query="INSERT INTO t VALUES (1)" --concurrency=1 --silent 2>&1
--echo # 3. Issue the replica restart while the source is running statements
--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
--let $rpl_server_parameters= --skip_slave_start=0 --rpl_semi_sync_replica_enabled=1
--let $rpl_server_number=2
--let $rpl_start_with_gtids= 1
--source include/rpl_restart_server.inc
--echo # 4. Sanity check - check whether semi-sync replication was correctly restarted
--source include/check_slave_is_running.inc
--source include/check_slave_no_error.inc
--let $assert_text= Semi sync should be enabled on the replica
--let $assert_variable_name= rpl_semi_sync_replica_enabled
--let $assert_variable_value= 1
--source include/assert_variable.inc
--echo # 5. Wait for source to finish the execution of statements
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--let $wait_condition=SELECT COUNT(*)=$iters FROM t
--let $wait_timeout= 120
--source include/wait_condition.inc
--echo # 6. Wait for replica to catch-up with latest changes
--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
--let $slave_timeout=600
--source include/rpl_sync.inc
--echo # 7. Check whether the replica replicated table correctly
--let $diff_tables = server_1:t, server_2:t
--source include/diff_tables.inc
--echo # 8. Clean up
--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
--source include/uninstall_semisync_replica.inc
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--eval SET GLOBAL replication_sender_observe_commit_only = OFF
--eval SET GLOBAL replication_optimize_for_static_plugin_config = OFF
--source include/uninstall_semisync_source.inc
DROP TABLE t;
--source include/rpl_end.inc
|