| 1 |
############################################################################### |
| 2 |
# Bug#21507981: REPLICATION POSITION LOST AFTER CRASH ON MTS CONFIGURED SLAVE |
| 3 |
# |
| 4 |
# Problem: |
| 5 |
# ======== |
| 6 |
# Enable MTS along with crash-safe replication tables. Make sure that the |
| 7 |
# server is busily inserting data with multiple threads in parallel. Shutdown mysqld |
| 8 |
# mysqld uncleanly (kill -9 or power off server without notice). |
| 9 |
# |
| 10 |
# Now users are restarting the server with --relay-log-recovery=1 to recover |
| 11 |
# the crashed slave. |
| 12 |
# |
| 13 |
# This results in following error: |
| 14 |
# ================================ |
| 15 |
# 2015-06-24 13:49:03 3895 [ERROR] --relay-log-recovery cannot be executed |
| 16 |
# when the slave was stopped with an error or killed in MTS mode; consider |
| 17 |
# using RESET SLAVE or restart the server with --relay-log-recovery = 0 |
| 18 |
# followed by START SLAVE UNTIL SQL_AFTER_MTS_GAPS. |
| 19 |
# |
| 20 |
# i.e relay-log-recovery will not work in MTS mode. |
| 21 |
############################################################################### |
| 22 |
# Following test demonstrates that when gaps are generated due to MTS crash |
| 23 |
# but not due to an error then recovery should be successful with |
| 24 |
# --relay-log-recovery=1 option. |
| 25 |
# |
| 26 |
# In case of Multi source replication all channels will go through the relay |
| 27 |
# log recovery process and gaps will be filled. |
| 28 |
|
| 29 |
# Test ensures that after crash recovery the slave is in a consistent state |
| 30 |
# and there are no gaps in MTS execution and it is up and running. |
| 31 |
|
| 32 |
#Skip on group replication runs |
| 33 |
--source include/not_group_replication_plugin.inc |
| 34 |
--source include/force_restart.inc |
| 35 |
--source include/have_binlog_format_statement.inc |
| 36 |
# Test requires master-info-repository=TABLE, relay-log-info-repository=TABLE |
| 37 |
--source include/have_slave_repository_type_table.inc |
| 38 |
--source include/only_mts_replica_parallel_workers.inc |
| 39 |
--source include/only_mts_replica_parallel_type_database.inc |
| 40 |
|
| 41 |
--echo # |
| 42 |
--echo # set up masters server_1 and server_3 with server_2 being a slave. |
| 43 |
--echo #. |
| 44 |
--let $rpl_topology= 1->2,3->2 |
| 45 |
--let $rpl_multi_source= 1 |
| 46 |
--source include/rpl_init.inc |
| 47 |
|
| 48 |
--echo #### I. Initialize slaves #### |
| 49 |
--let $rpl_connection_name= server_2 |
| 50 |
--source include/rpl_connection.inc |
| 51 |
--let $slave_stop_wait=5 |
| 52 |
|
| 53 |
--source include/rpl_stop_slaves.inc |
| 54 |
SET @save.innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout; |
| 55 |
--eval set @@global.innodb_lock_wait_timeout=$slave_stop_wait + 1000 |
| 56 |
|
| 57 |
--echo #start slave |
| 58 |
--source include/rpl_start_slaves.inc |
| 59 |
|
| 60 |
--echo # |
| 61 |
--echo # Generate MTS gaps for channel1. |
| 62 |
--echo # |
| 63 |
--let $rpl_connection_name= server_1 |
| 64 |
--source include/rpl_connection.inc |
| 65 |
--let $channel_id=1 |
| 66 |
--source extra/rpl_tests/rpl_multi_source_generate_mts_gap.test |
| 67 |
|
| 68 |
--echo # |
| 69 |
--echo # Generate MTS gaps for channel3. |
| 70 |
--echo # |
| 71 |
--let $rpl_connection_name= server_3 |
| 72 |
--source include/rpl_connection.inc |
| 73 |
--let $channel_id=3 |
| 74 |
--source extra/rpl_tests/rpl_multi_source_generate_mts_gap.test |
| 75 |
|
| 76 |
--let $rpl_connection_name= server_2 |
| 77 |
--source include/rpl_connection.inc |
| 78 |
CALL mtr.add_suppression("Recovery from source pos"); |
| 79 |
# Kill the slave server |
| 80 |
--source include/kill_mysqld.inc |
| 81 |
|
| 82 |
--let $rpl_server_number= 2 |
| 83 |
--let $rpl_server_parameters= --relay-log-recovery --skip-replica-start --gtid-mode=off |
| 84 |
--source include/rpl_start_server.inc |
| 85 |
|
| 86 |
--let $rpl_connection_name= server_2 |
| 87 |
--source include/rpl_connection.inc |
| 88 |
START SLAVE; |
| 89 |
|
| 90 |
|
| 91 |
# |
| 92 |
# Cleanup; This involves deleting/dropping and manual syncing |
| 93 |
# |
| 94 |
|
| 95 |
--echo # channel 1 |
| 96 |
--let $rpl_connection_name= server_1 |
| 97 |
--source include/rpl_connection.inc |
| 98 |
|
| 99 |
--let $rpl_channel_name= 'channel_1' |
| 100 |
--let $sync_slave_connection= server_2 |
| 101 |
--source include/sync_slave_sql_with_master.inc |
| 102 |
|
| 103 |
--echo # channel 3 |
| 104 |
--let $rpl_connection_name= server_3 |
| 105 |
--source include/rpl_connection.inc |
| 106 |
|
| 107 |
--let $rpl_channel_name= 'channel_3' |
| 108 |
--let $sync_slave_connection= server_2 |
| 109 |
--source include/sync_slave_sql_with_master.inc |
| 110 |
|
| 111 |
# now do the clean up |
| 112 |
|
| 113 |
--echo connection_server_1 |
| 114 |
--connection server_1 |
| 115 |
DROP DATABASE d1_1; |
| 116 |
DROP DATABASE d2_1; |
| 117 |
--let $rpl_channel_name= 'channel_1' |
| 118 |
--let $sync_slave_connection= server_2 |
| 119 |
--source include/sync_slave_sql_with_master.inc |
| 120 |
|
| 121 |
--echo connection_server_3 |
| 122 |
--connection server_3 |
| 123 |
DROP DATABASE d1_3; |
| 124 |
DROP DATABASE d2_3; |
| 125 |
--let $rpl_channel_name= 'channel_3' |
| 126 |
--let $sync_slave_connection= server_2 |
| 127 |
--source include/sync_slave_sql_with_master.inc |
| 128 |
|
| 129 |
--let $rpl_skip_sync= 1 |
| 130 |
--source include/rpl_end.inc |