| 1 |
--source include/have_binlog_format_statement.inc |
| 2 |
# Test requires master-info-repository=TABLE, relay-log-info-repository=TABLE |
| 3 |
--source include/have_slave_repository_type_table.inc |
| 4 |
--source include/master-slave.inc |
| 5 |
|
| 6 |
--source include/rpl_connection_slave.inc |
| 7 |
# |
| 8 |
# Bug #19930381 WL1697: 'START SLAVE' CRASHES POST RESTART |
| 9 |
# |
| 10 |
# Testing how well MSR manipulates the MTS Worker info table. |
| 11 |
# |
| 12 |
|
| 13 |
call mtr.add_suppression("Recovery from source pos .*"); |
| 14 |
call mtr.add_suppression("Corrupted table mysql.slave_worker_info"); |
| 15 |
call mtr.add_suppression("Could not delete from Replica Workers info repository"); |
| 16 |
|
| 17 |
--source include/stop_slave.inc |
| 18 |
RESET SLAVE ALL; |
| 19 |
SET @save.replica_parallel_workers=@@global.replica_parallel_workers; |
| 20 |
SET @@global.replica_parallel_workers=2; |
| 21 |
--replace_result $MASTER_MYPORT MASTER_PORT |
| 22 |
eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='localhost', SOURCE_USER='root', SOURCE_PORT=$MASTER_MYPORT FOR CHANNEL 'ch_a'; |
| 23 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST='dummy_host', SOURCE_USER='root', SOURCE_PORT=13010 FOR CHANNEL 'ch_b'; |
| 24 |
START SLAVE; |
| 25 |
|
| 26 |
--let $count=4 |
| 27 |
--let $table=mysql.slave_worker_info |
| 28 |
--source include/wait_until_rows_count.inc |
| 29 |
|
| 30 |
# Per channel removal from worker info table proof: |
| 31 |
STOP SLAVE FOR CHANNEL 'ch_b'; |
| 32 |
RESET SLAVE FOR CHANNEL 'ch_b'; |
| 33 |
--let $count=2 |
| 34 |
--let $table=mysql.slave_worker_info |
| 35 |
--source include/wait_until_rows_count.inc |
| 36 |
|
| 37 |
# |
| 38 |
# Testing error branches. |
| 39 |
# |
| 40 |
|
| 41 |
STOP SLAVE FOR CHANNEL 'ch_a'; |
| 42 |
# Faking the worker table info corruption |
| 43 |
ALTER TABLE mysql.slave_worker_info DROP PRIMARY KEY; |
| 44 |
|
| 45 |
--error ER_UNKNOWN_ERROR |
| 46 |
RESET SLAVE ALL FOR CHANNEL 'ch_a'; |
| 47 |
ALTER TABLE mysql.slave_worker_info ADD PRIMARY KEY (`channel_name`,`id`); |
| 48 |
# now to compensate the above fake with removing the aimed records |
| 49 |
DELETE FROM mysql.slave_worker_info WHERE channel_name like 'ch_a'; |
| 50 |
STOP SLAVE IO_THREAD; |
| 51 |
|
| 52 |
--replace_result $MASTER_MYPORT MASTER_PORT |
| 53 |
eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='localhost', SOURCE_USER='root', SOURCE_PORT=$MASTER_MYPORT FOR CHANNEL 'ch_b'; |
| 54 |
--let $assert_text=Two workers are expected to survive the last RESET SLAVE |
| 55 |
--let $assert_cond= `SELECT COUNT(*) = 0 FROM mysql.slave_worker_info` |
| 56 |
--source include/assert.inc |
| 57 |
|
| 58 |
--let $rpl_channel_name= 'ch_b' |
| 59 |
--source include/start_slave.inc |
| 60 |
|
| 61 |
# |
| 62 |
# Testing Worker info table after server restarts. |
| 63 |
# |
| 64 |
--echo |
| 65 |
--echo === RESTART SERVER === |
| 66 |
--let $rpl_omit_print_server_parameters= 1 |
| 67 |
--let $rpl_server_number= 1 |
| 68 |
--let $rpl_server_parameters= |
| 69 |
--source include/rpl_restart_server.inc |
| 70 |
|
| 71 |
--let $rpl_server_number= 2 |
| 72 |
--let $rpl_server_parameters= --skip-replica-start |
| 73 |
--source include/rpl_restart_server.inc |
| 74 |
|
| 75 |
--source include/rpl_connection_slave.inc |
| 76 |
--replace_result $MASTER_MYPORT MASTER_PORT |
| 77 |
eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_USER='root', SOURCE_PORT=$MASTER_MYPORT FOR CHANNEL 'ch_b'; |
| 78 |
START SLAVE; |
| 79 |
|
| 80 |
STOP SLAVE; |
| 81 |
RESET SLAVE ALL; |
| 82 |
|
| 83 |
--let $rpl_skip_stop_slave=1 |
| 84 |
--let $rpl_skip_sync = 1 |
| 85 |
|
| 86 |
--source include/rpl_end.inc |