| 1 |
################################################################################ |
| 2 |
# ==== Purpose ==== |
| 3 |
# The purpose of this test is to verify that, in single thread replication |
| 4 |
# mode when applier thread is handling a transaction that interacts with |
| 5 |
# non-transaction tables, server should not report error when applier thread is |
| 6 |
# being stopped in the middle of a transaction and able to complete the |
| 7 |
# transaction with in the timeout which is hard-coded to 60 seconds. |
| 8 |
# |
| 9 |
# ==== Requirement ==== |
| 10 |
# In single thread replication, when applier thread is being stopped in the |
| 11 |
# middle of a transaction that interacts with non-transactional tables, there |
| 12 |
# should not be any error if the transaction is able to complete with in the |
| 13 |
# timeout. When the applier thread is restarted, the timeout should be reset, |
| 14 |
# so that the next 'stop replica sql_thread' statement again gives a 60 seconds |
| 15 |
# interval for non-transactional statements to complete. Also replica should be |
| 16 |
# stopped successfully. |
| 17 |
# |
| 18 |
# ==== Implementation ==== |
| 19 |
# 1. Create source-replica topology and initial setup. |
| 20 |
# 2. Execute insert statement followed by STOP REPLICA SQL_THREAD for two times. |
| 21 |
# 2.1 Execute a statement on source. |
| 22 |
# 2.2 Verify that applier thread is waiting on debug sync point. |
| 23 |
# 2.3 Execute 'stop replica sql_thread' and let it wait on debug sync point. |
| 24 |
# 2.4 Continue applier thread. |
| 25 |
# 2.5 Continue 'stop replica sql_thread'. |
| 26 |
# 2.6 Execute 'start replica sql_thread'. |
| 27 |
# 3. Cleanup. |
| 28 |
# |
| 29 |
# ==== References ==== |
| 30 |
# BUG#33646899: MTS + STOP SLAVE SQL_THREAD + group of rep events stops |
| 31 |
# before 60 sec timeout |
| 32 |
################################################################################ |
| 33 |
|
| 34 |
source include/have_myisam.inc; |
| 35 |
source include/have_debug.inc; |
| 36 |
source include/have_debug_sync.inc; |
| 37 |
source include/have_binlog_format_row.inc; |
| 38 |
source include/big_test.inc; |
| 39 |
source include/not_mts_replica_parallel_workers.inc; |
| 40 |
|
| 41 |
--echo # |
| 42 |
--echo # 1. Create source-replica topology and initial setup. |
| 43 |
source include/master-slave.inc; |
| 44 |
CREATE TABLE t1(c1 INT) ENGINE=MyISAM; |
| 45 |
|
| 46 |
--source include/sync_slave_sql_with_master.inc |
| 47 |
call mtr.add_suppression("Replica SQL for channel.*Request to stop replica SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); |
| 48 |
|
| 49 |
# Adding debug sync points to execute special code required for this test |
| 50 |
--let $debug_point=wait_after_do_update_pos |
| 51 |
--source include/add_debug_point.inc |
| 52 |
|
| 53 |
--echo # |
| 54 |
--echo # 2. Execute insert statement followed by STOP REPLICA SQL_THREAD for two |
| 55 |
--echo # times. Wait for SLAVE_WAIT_GROUP_DONE(60s) after first iteration. |
| 56 |
--let $iter=0 |
| 57 |
while ($iter < 2) |
| 58 |
{ |
| 59 |
--echo # |
| 60 |
--echo # 2.1 Execute a statement on source. |
| 61 |
--source include/rpl_connection_master.inc |
| 62 |
--send INSERT INTO t1 (c1) VALUES (1); |
| 63 |
|
| 64 |
--echo # |
| 65 |
--echo # 2.2 Verify that applier thread is waiting on debug sync point. |
| 66 |
--source include/rpl_connection_slave.inc |
| 67 |
--let $wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State = 'debug sync point: now'; |
| 68 |
--source include/wait_condition.inc |
| 69 |
|
| 70 |
--echo # |
| 71 |
--echo # 2.3 Execute 'stop replica sql_thread' and let it wait |
| 72 |
--echo # on debug sync point. |
| 73 |
# Let 'stop replica sql_thread' reach the point where it sets the 'abort_slave' |
| 74 |
# flag for the applier thread. This ensures that the applier thread starts |
| 75 |
# the 60 seconds countdown once it is unpaused. |
| 76 |
--let $statement_connection = slave |
| 77 |
--let $statement = stop replica sql_thread |
| 78 |
--let $auxiliary_connection = server_2_1 |
| 79 |
--let $sync_point = terminate_slave_threads_after_set_abort_slave |
| 80 |
--source include/execute_to_sync_point.inc |
| 81 |
|
| 82 |
--echo # |
| 83 |
--echo # 2.4 Continue applier thread. |
| 84 |
SET DEBUG_SYNC= 'now SIGNAL signal.after_do_update_pos_continue'; |
| 85 |
|
| 86 |
--echo # |
| 87 |
--echo # 2.5 Continue 'stop replica sql_thread'. |
| 88 |
--source include/execute_from_sync_point.inc |
| 89 |
|
| 90 |
--source include/rpl_connection_master.inc |
| 91 |
--reap; |
| 92 |
|
| 93 |
#wait till SLAVE_WAIT_GROUP_DONE |
| 94 |
if ($iter == 0) |
| 95 |
{ |
| 96 |
--sleep 61 |
| 97 |
} |
| 98 |
|
| 99 |
--source include/rpl_connection_slave.inc |
| 100 |
if ($iter == 1) |
| 101 |
{ |
| 102 |
# Remove debug sync point |
| 103 |
--let $debug_point=wait_after_do_update_pos |
| 104 |
--source include/remove_debug_point.inc |
| 105 |
} |
| 106 |
|
| 107 |
--echo # |
| 108 |
--echo # 2.6 Execute 'start replica sql_thread'. |
| 109 |
--source include/start_slave_sql.inc |
| 110 |
|
| 111 |
--inc $iter |
| 112 |
} |
| 113 |
|
| 114 |
--echo # |
| 115 |
--echo # 3. Cleanup. |
| 116 |
--source include/rpl_connection_master.inc |
| 117 |
DROP TABLE t1; |
| 118 |
--source include/rpl_end.inc |