| 1 |
# ==== Purpose ==== |
| 2 |
# This test case verifies that receiver threads GTID sets do not rely on |
| 3 |
# global SID anymore. Because of this, it is possible to have a receiver |
| 4 |
# thread receiving GTIDs (and adding them to its retrieved GTID set) and |
| 5 |
# having the server applying GTIDs from a server UUID that doesn't belong |
| 6 |
# to the global SID map yet. |
| 7 |
# |
| 8 |
# The test uses debug instrumentation to pause the receiver thread while |
| 9 |
# adding the received gtid to received_transaction_set and verifies that |
| 10 |
# restoring backup from a server it never applied transactions is successful. |
| 11 |
# |
| 12 |
# ==== Related Bugs and Worklogs ==== |
| 13 |
# |
| 14 |
# WL#8599: Reduce contention in IO and SQL threads |
| 15 |
# |
| 16 |
|
| 17 |
--source include/have_debug.inc |
| 18 |
--source include/have_debug_sync.inc |
| 19 |
# Test requires master-info-repository=TABLE, relay-log-info-repository=TABLE |
| 20 |
--source include/have_slave_repository_type_table.inc |
| 21 |
|
| 22 |
--let $rpl_skip_start_slave=1 |
| 23 |
--let $rpl_gtid_utils=1 |
| 24 |
--let $rpl_multi_source=1 |
| 25 |
--let $rpl_topology=1->2,3->2,4->2 |
| 26 |
--source include/rpl_init.inc |
| 27 |
|
| 28 |
--let $rpl_connection_name= server_1 |
| 29 |
--source include/rpl_connection.inc |
| 30 |
--let $server1_uuid=`SELECT @@global.server_uuid` |
| 31 |
# Create one table, populate it, then drop it |
| 32 |
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB; |
| 33 |
INSERT INTO t1 VALUES(1); |
| 34 |
|
| 35 |
--let $rpl_connection_name= server_2 |
| 36 |
--source include/rpl_connection.inc |
| 37 |
--let $rpl_channel_name='channel_1' |
| 38 |
--source include/start_slave.inc |
| 39 |
|
| 40 |
# Add debug instrumentation to hold the receiver thread |
| 41 |
# while writing to the relay log. |
| 42 |
--let $debug_point=updating_received_transaction_set |
| 43 |
--source include/add_debug_point.inc |
| 44 |
|
| 45 |
# Execute transaction on server1 |
| 46 |
--let $rpl_connection_name= server_1 |
| 47 |
--source include/rpl_connection.inc |
| 48 |
INSERT INTO t1 VALUES(2); |
| 49 |
|
| 50 |
# Wait until the receiver reached the debug point on server2 |
| 51 |
--let $rpl_connection_name= server_2 |
| 52 |
--source include/rpl_connection.inc |
| 53 |
SET DEBUG_SYNC="now WAIT_FOR reached_updating_received_transaction_set"; |
| 54 |
|
| 55 |
# Remove the debug point on server2 |
| 56 |
--let $debug_point=updating_received_transaction_set |
| 57 |
--source include/remove_debug_point.inc |
| 58 |
|
| 59 |
--let $rpl_connection_name= server_4 |
| 60 |
--source include/rpl_connection.inc |
| 61 |
# Create one table, populate it, then drop it |
| 62 |
CREATE TABLE t4 (c1 INT) ENGINE=InnoDB; |
| 63 |
INSERT INTO t4 VALUES(1); |
| 64 |
DROP TABLE t4; |
| 65 |
--let $server4_gtid_executed=`SELECT @@GLOBAL.gtid_executed` |
| 66 |
|
| 67 |
--let $rpl_connection_name= server_2 |
| 68 |
--source include/rpl_connection.inc |
| 69 |
START SLAVE FOR CHANNEL 'channel_4'; |
| 70 |
--echo Wait until channel_4 be synchronized with master |
| 71 |
--let $wait_condition= SELECT RECEIVED_TRANSACTION_SET='$server4_gtid_executed' FROM performance_schema.replication_connection_status WHERE CHANNEL_NAME = 'channel_4' |
| 72 |
--source include/wait_condition_or_abort.inc |
| 73 |
|
| 74 |
# Execute transactions on server3 to take backup |
| 75 |
--let $rpl_connection_name= server_3 |
| 76 |
--source include/rpl_connection.inc |
| 77 |
# Execute transactions on server3/master2 |
| 78 |
CREATE TABLE t2 (a int); |
| 79 |
INSERT INTO t2 VALUES(1); |
| 80 |
INSERT INTO t2 VALUES(2); |
| 81 |
|
| 82 |
# Get the binlog file for backup |
| 83 |
--let $server3_datadir = `SELECT @@DATADIR` |
| 84 |
--let $server3_binlog_file=query_get_value(SHOW MASTER STATUS, File, 1) |
| 85 |
--let $server3_gtid = `SELECT @@GLOBAL.GTID_EXECUTED` |
| 86 |
--let $server3_uuid = `SELECT @@global.server_uuid` |
| 87 |
|
| 88 |
--let $rpl_connection_name= server_2 |
| 89 |
--source include/rpl_connection.inc |
| 90 |
# Setting the arguments to connect to server2 |
| 91 |
--let $server2_uuid = `SELECT @@global.server_uuid` |
| 92 |
--let $server2_connection_args= --user=root --host=127.0.0.1 --port=$SERVER_MYPORT_2 |
| 93 |
# Restoring the backup file on server3 using mysqlbinlog client and the connection arguments set above |
| 94 |
--exec $MYSQL_BINLOG $server3_datadir/$server3_binlog_file | $MYSQL $server2_connection_args |
| 95 |
|
| 96 |
--let $assert_text= Restoring backup is successful |
| 97 |
--let $assert_cond= GTID_IS_EQUAL(GTID_INTERSECTION_WITH_UUID(@@GLOBAL.GTID_EXECUTED,"$server3_uuid"),"$server3_gtid") |
| 98 |
--source include/assert.inc |
| 99 |
|
| 100 |
# Let the receiver of server2 continue |
| 101 |
SET DEBUG_SYNC="now SIGNAL continue_updating_received_transaction_set"; |
| 102 |
|
| 103 |
# Cleanup |
| 104 |
--let $rpl_connection_name= server_1 |
| 105 |
--source include/rpl_connection.inc |
| 106 |
DROP TABLE t1; |
| 107 |
|
| 108 |
--let $rpl_channel_name= 'channel_1' |
| 109 |
--let $sync_slave_connection= server_2 |
| 110 |
--source include/sync_slave_sql_with_master.inc |
| 111 |
|
| 112 |
--let $rpl_channel_name= 'channel_3' |
| 113 |
--source include/start_slave.inc |
| 114 |
|
| 115 |
--let $rpl_connection_name= server_3 |
| 116 |
--source include/rpl_connection.inc |
| 117 |
DROP TABLE t2; |
| 118 |
|
| 119 |
--let $rpl_channel_name= 'channel_3' |
| 120 |
--let $sync_slave_connection= server_2 |
| 121 |
--source include/sync_slave_sql_with_master.inc |
| 122 |
|
| 123 |
--let $rpl_skip_sync=1 |
| 124 |
--source include/rpl_end.inc |