| 1 |
# WL#1697: Multisource replication |
| 2 |
# |
| 3 |
# Test the behaviour when sql_replica_skip_counter is set |
| 4 |
# |
| 5 |
# BUG#19634753: WL1697: IF SQL_REPLICA_SKIP_COUNTER > 0, IO_THREAD(S) ARE |
| 6 |
# NOT ABLE TO START |
| 7 |
# BUG#20400518 |
| 8 |
# The behavior for MySQL 5.7 should be: |
| 9 |
# |
| 10 |
# sql_replica_skip_counter can be set at anytime, even some channels are running. |
| 11 |
# Setting sql_replica_skip_counter doesn't effect any running channel. Its value |
| 12 |
# only effects the first channel starting after the |
| 13 |
# 'SET GLOBAL sql_replica_skip_counter'. After the channel starts, |
| 14 |
# sql_replica_skip_counter will be reset to 0 automatically. |
| 15 |
# |
| 16 |
# The process like: |
| 17 |
# |
| 18 |
# SET GLOBAL sql_replica_skip_counter = 5; |
| 19 |
# START SLAVE FOR CHANNEL 'ch1'; |
| 20 |
# |
| 21 |
# SHOW SLAVE STATUS FOR CHANNEL 'channel_1'; |
| 22 |
# Skip_count item will be 5. |
| 23 |
# |
| 24 |
# SELECT @@GLOBAL.sql_replica_skip_counter; |
| 25 |
# It will be 0. |
| 26 |
# |
| 27 |
# |
| 28 |
# START SLAVE will report the error ER_REPLICA_CHANNEL_SQL_SKIP_COUNTER if it is |
| 29 |
# starting more than one channels. |
| 30 |
# |
| 31 |
# |
| 32 |
#Skip on group replication runs |
| 33 |
--source include/not_group_replication_plugin.inc |
| 34 |
--source include/have_binlog_format_mixed.inc |
| 35 |
# Test requires master-info-repository=TABLE, relay-log-info-repository=TABLE |
| 36 |
--source include/have_slave_repository_type_table.inc |
| 37 |
|
| 38 |
--echo # |
| 39 |
--echo # set up masters server_1 and server_3 with server_2 being a slave. |
| 40 |
--echo #. |
| 41 |
--let $rpl_multi_source= 1 |
| 42 |
--let $rpl_topology= 1->2,3->2 |
| 43 |
--source include/rpl_init.inc |
| 44 |
|
| 45 |
# On slave |
| 46 |
--let $rpl_connection_name= server_2 |
| 47 |
--source include/rpl_connection.inc |
| 48 |
call mtr.add_suppression("Replica: Could not start replica for channel"); |
| 49 |
|
| 50 |
--echo # |
| 51 |
--echo # Verify that Setting sql_replica_skip_counter doesn't effect running |
| 52 |
--echo # channels |
| 53 |
--echo # |
| 54 |
SET GLOBAL sql_replica_skip_counter= 1; |
| 55 |
|
| 56 |
--let $skip_counter= query_get_value(SHOW SLAVE STATUS FOR CHANNEL 'channel_1', Skip_Counter, 1) |
| 57 |
--let $assert_text= check that channel_1's Skip_Counter is 0. |
| 58 |
--echo $skip_counter |
| 59 |
--let $assert_cond= $skip_counter=0 |
| 60 |
--source include/assert.inc |
| 61 |
|
| 62 |
# stop SQL THREAD for all channels |
| 63 |
STOP SLAVE SQL_THREAD; |
| 64 |
--let $rpl_source_file= include/wait_for_slave_sql_to_stop.inc |
| 65 |
--source include/rpl_for_each_connection.inc |
| 66 |
|
| 67 |
--echo # |
| 68 |
--echo # Verify that START SLAVE FOR CHANNEL will copy sql_replica_skip_counter's |
| 69 |
--echo # value to the channel and reset sql_replica_skip_counter to 0 |
| 70 |
--echo # |
| 71 |
|
| 72 |
# first stop the channels |
| 73 |
--let $rpl_connection_name= server_2 |
| 74 |
--source include/rpl_connection.inc |
| 75 |
--source include/stop_slave.inc |
| 76 |
|
| 77 |
--let $rpl_channel_name= 'channel_1' |
| 78 |
--source include/start_slave.inc |
| 79 |
|
| 80 |
--let $skip_counter= query_get_value(SHOW SLAVE STATUS FOR CHANNEL 'channel_1', Skip_Counter, 1) |
| 81 |
--let $assert_text= check that channel_1's Skip_Counter is 0. |
| 82 |
--echo $skip_counter |
| 83 |
--let $assert_cond= $skip_counter= 1 |
| 84 |
--source include/assert.inc |
| 85 |
|
| 86 |
--let $assert_text= check that sql_replica_skip_counter is 0 |
| 87 |
--let $assert_cond= @@GLOBAL.sql_replica_skip_counter = 0 |
| 88 |
--source include/assert.inc |
| 89 |
|
| 90 |
--echo # |
| 91 |
--echo # START SLAVE [SQL_THREAD] will fail when sql_replica_skip_counter is 1 |
| 92 |
--echo # and there are more than one channels |
| 93 |
--echo # |
| 94 |
SET GLOBAL sql_replica_skip_counter = 1; |
| 95 |
|
| 96 |
--error ER_REPLICA_CHANNEL_SQL_SKIP_COUNTER |
| 97 |
START SLAVE; |
| 98 |
|
| 99 |
--error ER_REPLICA_CHANNEL_SQL_SKIP_COUNTER |
| 100 |
START SLAVE SQL_THREAD; |
| 101 |
|
| 102 |
--echo # |
| 103 |
--echo # START SLAVE IO_THREAD should not fail. |
| 104 |
--echo # |
| 105 |
|
| 106 |
--disable_warnings |
| 107 |
START SLAVE IO_THREAD; |
| 108 |
--enable_warnings |
| 109 |
--let $rpl_source_file= include/wait_for_slave_io_to_start.inc |
| 110 |
--source include/rpl_for_each_connection.inc |
| 111 |
|
| 112 |
--let $assert_text= All two IO threads are running after START SLAVE IO_THREAD |
| 113 |
--let $assert_cond= [SELECT COUNT(*) FROM performance_schema.replication_connection_status WHERE Service_State="ON"] = 2; |
| 114 |
--source include/assert.inc |
| 115 |
|
| 116 |
SET GLOBAL sql_replica_skip_counter= 0; |
| 117 |
|
| 118 |
# End MSR setup. |
| 119 |
--let $rpl_skip_sync= 1 |
| 120 |
--let $rpl_only_running_threads= 1 |
| 121 |
--source include/rpl_end.inc |