| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# This test validates that relay log recovery still works as expected for |
| 4 |
# channels that use GTID_ONLY and have outdated repository information. |
| 5 |
# |
| 6 |
# ==== Requirements ==== |
| 7 |
# |
| 8 |
# R1. Relay log recovery works with GTID_ONLY = 1 |
| 9 |
# |
| 10 |
# ==== Implementation ==== |
| 11 |
# |
| 12 |
# 1. Make the channel use GTID_ONLY=1 |
| 13 |
# Create a table on the source and replicate it. |
| 14 |
# Add some data making the binlog and relay rotate so the info on the repos is stale |
| 15 |
# 2. Restart the replica with relay log recovery |
| 16 |
# Check that the replica wont replicate old transactions even if position are outdated |
| 17 |
# 3. Cleanup |
| 18 |
# |
| 19 |
# ==== References ==== |
| 20 |
# |
| 21 |
# WL#7491: GTID-based replication applier recovery and positioning |
| 22 |
# |
| 23 |
|
| 24 |
--source include/have_binlog_format_row.inc |
| 25 |
--let $rpl_skip_start_slave= 1 |
| 26 |
--source include/master-slave.inc |
| 27 |
|
| 28 |
--echo # |
| 29 |
--echo # 1. Make the channel use GTID_ONLY=1 |
| 30 |
--echo # Create a table on the source and replicate it. |
| 31 |
--echo # Add some data making the binlog and relay rotate so the info on the repos is stale |
| 32 |
|
| 33 |
--source include/rpl_connection_slave.inc |
| 34 |
|
| 35 |
--source include/gtid_utils.inc |
| 36 |
|
| 37 |
CHANGE REPLICATION SOURCE TO GTID_ONLY = 1, REQUIRE_ROW_FORMAT=1; |
| 38 |
|
| 39 |
--source include/start_slave.inc |
| 40 |
|
| 41 |
--source include/rpl_connection_master.inc |
| 42 |
|
| 43 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY); |
| 44 |
|
| 45 |
--source include/sync_slave_sql_with_master.inc |
| 46 |
|
| 47 |
let $i=3; |
| 48 |
while($i) |
| 49 |
{ |
| 50 |
--source include/rpl_connection_master.inc |
| 51 |
|
| 52 |
--eval INSERT INTO t1 VALUES ($i) |
| 53 |
|
| 54 |
FLUSH LOGS; |
| 55 |
|
| 56 |
--source include/sync_slave_sql_with_master.inc |
| 57 |
|
| 58 |
--source include/stop_slave.inc |
| 59 |
|
| 60 |
--source include/start_slave.inc |
| 61 |
|
| 62 |
--dec $i |
| 63 |
} |
| 64 |
|
| 65 |
--echo # |
| 66 |
--echo # 2. Restart the replica with relay log recovery |
| 67 |
--echo # Check that the replica wont replicate old transactions even if position are outdated |
| 68 |
|
| 69 |
--let $rpl_server_parameters= --skip_replica_start=FALSE --relay_log_recovery=1 |
| 70 |
--let $rpl_server_number = 2 |
| 71 |
--source include/rpl_restart_server.inc |
| 72 |
|
| 73 |
--source include/rpl_connection_master.inc |
| 74 |
|
| 75 |
INSERT INTO t1 VALUES(4); |
| 76 |
|
| 77 |
--source include/sync_slave_sql_with_master.inc |
| 78 |
|
| 79 |
--let $local_gtid_set= query_get_value(SHOW REPLICA STATUS, Retrieved_Gtid_Set, 1) |
| 80 |
|
| 81 |
--let $assert_text= Exactly 1 GTIDs should have been retrieved since last invocation |
| 82 |
--let $assert_cond= GTID_COUNT("$local_gtid_set") = 1 |
| 83 |
--source include/assert.inc |
| 84 |
|
| 85 |
--let $assert_file=$MYSQLTEST_VARDIR/log/mysqld.2.err |
| 86 |
--let $assert_count= 1 |
| 87 |
--let $assert_select= Relay log recovery on channel with GTID_ONLY=1. The channel will switch to a new relay log and the GTID protocol will be used to replicate unapplied transactions. |
| 88 |
--let $assert_text= The relay log recovery message does not mention positions |
| 89 |
--source include/assert_grep.inc |
| 90 |
|
| 91 |
--echo # |
| 92 |
--echo # 3. Cleanup |
| 93 |
|
| 94 |
--source include/stop_slave.inc |
| 95 |
|
| 96 |
CHANGE REPLICATION SOURCE TO GTID_ONLY = 0, REQUIRE_ROW_FORMAT=0; |
| 97 |
|
| 98 |
--source include/start_slave.inc |
| 99 |
|
| 100 |
--source include/gtid_utils_end.inc |
| 101 |
|
| 102 |
let $messages = |
| 103 |
Relay log recovery on channel with GTID_ONLY=1. The channel will switch to a new relay log and the GTID protocol will be used to replicate unapplied transactions. |
| 104 |
; |
| 105 |
--source include/suppress_messages.inc |
| 106 |
|
| 107 |
|
| 108 |
--source include/rpl_connection_master.inc |
| 109 |
|
| 110 |
DROP TABLE t1; |
| 111 |
|
| 112 |
--source include/rpl_end.inc |