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