| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# This test will create two channels and will schedule many parallel |
| 4 |
# replication administrative statements for each channel per second during |
| 5 |
# a period of 10 seconds. |
| 6 |
# |
| 7 |
# After the testing period, the slave should be able to run replication |
| 8 |
# administrative statements to stop and reset the two created channels |
| 9 |
# without any contention. |
| 10 |
# |
| 11 |
# ==== Related Bugs and Worklogs ==== |
| 12 |
# |
| 13 |
# BUG#20593028 MORE CONCURRENCY IN SHOW SLAVE STATUS: MAKE LOCK_MSR_MAP |
| 14 |
# AN RWLOCK |
| 15 |
# |
| 16 |
|
| 17 |
--source include/not_group_replication_plugin.inc |
| 18 |
# This test case is binary log format agnostic |
| 19 |
--source include/have_binlog_format_row.inc |
| 20 |
# Test requires master-info-repository=TABLE, relay-log-info-repository=TABLE |
| 21 |
--source include/have_slave_repository_type_table.inc |
| 22 |
--source include/master-slave.inc |
| 23 |
|
| 24 |
--source include/rpl_connection_slave.inc |
| 25 |
|
| 26 |
CALL mtr.add_suppression('Replica failed to initialize connection metadata structure from the repository'); |
| 27 |
CALL mtr.add_suppression('This operation cannot be performed with a running replica'); |
| 28 |
CALL mtr.add_suppression('Could not find target log file mentioned in applier metadata in the index file'); |
| 29 |
# For case: |
| 30 |
# STOP SLAVE SQL_THREAD; // IO_THREAD is running |
| 31 |
# CHANGE MASTER TO relay_log_name = 'non-existing relay log name',...; |
| 32 |
# While CHANGE MASTER throwns an error, group_relay_log_name is changed to the |
| 33 |
# non-existing file name. |
| 34 |
# START SLAVE SQL_THREAD; // It will log below error. |
| 35 |
CALL mtr.add_suppression('Could not find relay log file'); |
| 36 |
CALL mtr.add_suppression('A replica with the same server_uuid/server_id as this replica has connected to the source'); |
| 37 |
|
| 38 |
# Save current event scheduler status |
| 39 |
SET @saved_event_scheduler= @@GLOBAL.event_scheduler; |
| 40 |
# relay_log_purge might be set to 0 by e_change_maste_sql_ch* below |
| 41 |
SET @saved_relay_log_purge= @@GLOBAL.relay_log_purge; |
| 42 |
SET @@GLOBAL.event_scheduler= OFF; |
| 43 |
|
| 44 |
# Define the amount of channels to create |
| 45 |
--let $num_channels= 2 |
| 46 |
|
| 47 |
# Stop slave for the default channel |
| 48 |
--source include/stop_slave.inc |
| 49 |
|
| 50 |
--let $c= 0 |
| 51 |
while ($c <= $num_channels) |
| 52 |
{ |
| 53 |
# The channel name |
| 54 |
--let $cn= 'ch$c' |
| 55 |
# The relay log suffix |
| 56 |
--let $rls= -ch$c |
| 57 |
if ($c == 0) |
| 58 |
{ |
| 59 |
# For the default channel |
| 60 |
--let $cn= '' |
| 61 |
--let $rls= |
| 62 |
} |
| 63 |
--replace_result $MASTER_MYPORT SOURCE_PORT |
| 64 |
--eval CREATE EVENT e_change_master_io_ch$c ON SCHEDULE EVERY 1 SECOND DO CHANGE REPLICATION SOURCE TO SOURCE_USER='root', SOURCE_HOST='127.0.0.1', SOURCE_PORT=$MASTER_MYPORT FOR CHANNEL $cn |
| 65 |
--eval CREATE EVENT e_change_master_sql_ch$c ON SCHEDULE EVERY 1 SECOND DO CHANGE REPLICATION SOURCE TO RELAY_LOG_FILE='slave-relay-bin$rls.000001', RELAY_LOG_POS=4 FOR CHANNEL $cn |
| 66 |
--eval CREATE EVENT e_start_slave_io_ch$c ON SCHEDULE EVERY 1 SECOND DO START SLAVE IO_THREAD FOR CHANNEL $cn |
| 67 |
--eval CREATE EVENT e_stop_slave_io_ch$c ON SCHEDULE EVERY 1 SECOND DO STOP SLAVE IO_THREAD FOR CHANNEL $cn |
| 68 |
--eval CREATE EVENT e_reset_slave_ch$c ON SCHEDULE EVERY 1 SECOND DO RESET SLAVE FOR CHANNEL $cn |
| 69 |
--eval CREATE EVENT e_reset_slave_all_ch$c ON SCHEDULE EVERY 1 SECOND DO RESET SLAVE ALL FOR CHANNEL $cn |
| 70 |
--eval CREATE EVENT e_start_slave_sql_ch$c ON SCHEDULE EVERY 1 SECOND DO START SLAVE SQL_THREAD FOR CHANNEL $cn |
| 71 |
--eval CREATE EVENT e_stop_slave_sql_ch$c ON SCHEDULE EVERY 1 SECOND DO STOP SLAVE SQL_THREAD FOR CHANNEL $cn |
| 72 |
--eval CREATE EVENT e_sss_ch$c ON SCHEDULE EVERY 1 SECOND DO SHOW SLAVE STATUS FOR CHANNEL $cn |
| 73 |
if ($c == 0) |
| 74 |
{ |
| 75 |
--eval CREATE EVENT e_reset_master ON SCHEDULE EVERY 1 SECOND DO RESET MASTER |
| 76 |
--eval CREATE EVENT e_ils ON SCHEDULE EVERY 1 SECOND DO SELECT * FROM performance_schema.log_status |
| 77 |
} |
| 78 |
--inc $c |
| 79 |
} |
| 80 |
|
| 81 |
# Let the game begin... |
| 82 |
SET @@GLOBAL.event_scheduler= ON; |
| 83 |
|
| 84 |
--echo Let the requests to run in parallel for 10 seconds |
| 85 |
sleep 10; |
| 86 |
|
| 87 |
# |
| 88 |
# Test case cleanup |
| 89 |
# |
| 90 |
--let $c= $num_channels |
| 91 |
while ($c >= 0) |
| 92 |
{ |
| 93 |
if ($c == 0) |
| 94 |
{ |
| 95 |
--eval DROP EVENT e_ils |
| 96 |
--eval DROP EVENT e_reset_master |
| 97 |
} |
| 98 |
--eval DROP EVENT e_sss_ch$c |
| 99 |
--eval DROP EVENT e_stop_slave_sql_ch$c |
| 100 |
--eval DROP EVENT e_start_slave_sql_ch$c |
| 101 |
--eval DROP EVENT e_reset_slave_all_ch$c |
| 102 |
--eval DROP EVENT e_reset_slave_ch$c |
| 103 |
--eval DROP EVENT e_stop_slave_io_ch$c |
| 104 |
--eval DROP EVENT e_start_slave_io_ch$c |
| 105 |
--eval DROP EVENT e_change_master_sql_ch$c |
| 106 |
--eval DROP EVENT e_change_master_io_ch$c |
| 107 |
--dec $c |
| 108 |
} |
| 109 |
|
| 110 |
--let $scheduler_thread_id= `SELECT THREAD_ID FROM performance_schema.threads WHERE NAME = "thread/sql/event_scheduler"` |
| 111 |
# Stop the scheduler |
| 112 |
# If something bad happened, the test case should be stuck here |
| 113 |
SET @@GLOBAL.event_scheduler= OFF; |
| 114 |
|
| 115 |
--echo # Wait until all scheduler activity has finished |
| 116 |
--let $wait_condition= SELECT COUNT(*) = 0 FROM performance_schema.threads WHERE PARENT_THREAD_ID=$scheduler_thread_id |
| 117 |
--source include/wait_condition.inc |
| 118 |
|
| 119 |
# Stop and remove all created channels |
| 120 |
--disable_warnings |
| 121 |
--let $c= $num_channels |
| 122 |
while ($c > 0) |
| 123 |
{ |
| 124 |
--error 0, ER_REPLICA_CHANNEL_DOES_NOT_EXIST |
| 125 |
--eval STOP SLAVE FOR CHANNEL 'ch$c' |
| 126 |
--dec $c |
| 127 |
} |
| 128 |
STOP SLAVE FOR CHANNEL ''; |
| 129 |
RESET SLAVE ALL; |
| 130 |
# Reconfigure the default channel |
| 131 |
--replace_result $MASTER_MYPORT SOURCE_PORT |
| 132 |
--eval CHANGE REPLICATION SOURCE TO SOURCE_USER='root', SOURCE_HOST='127.0.0.1', SOURCE_PORT=$MASTER_MYPORT |
| 133 |
--enable_warnings |
| 134 |
|
| 135 |
# Restore the scheduler and relay_log_purge |
| 136 |
SET @@GLOBAL.event_scheduler = @saved_event_scheduler; |
| 137 |
SET @@GLOBAL.relay_log_purge = @saved_relay_log_purge; |
| 138 |
|
| 139 |
# To avoid problems in start_slave.inc and rpl_end.inc |
| 140 |
--let $rpl_channel_name= |
| 141 |
--let $_for_channel_clause= |
| 142 |
--source include/start_slave.inc |
| 143 |
--source include/rpl_end.inc |