Debian Codegraph @

mysql-test/suite/rpl/t/rpl_mts_slave_hang_with_partial_trx.test

raw
1 # ==== Purpose ====
2 #
3 # Verify if the MTS SQL thread will became unresponsive after the slave
4 # applied a partial transaction (without the XID event) followed by a
5 # ROTATE event caused by IO thread reconnection when GTIDs and auto
6 # positioning are enabled.
7 #
8 # ==== Related Bugs and Worklogs ====
9 #
10 # BUG#17326020 ASSERTION ON SLAVE AFTER STOP/START SLAVE USING MTS+GTID
11 # REPLICATION
12 # BUG#18885916 RELAY LOG WITHOUT XID_LOG_EVENT MAY CASE PARALLEL
13 # REPLICATION HANG
14 #
15 # ==== Implementation ====
16 #
17 # This test uses debug points on the slave to make the
18 # IO thread to stop right after queuing a WRITE_ROWS log event.
19 #
20 # By doing this, the relay log file with the partial transaction
21 # will contain: [GTID,] QUERY(BEGIN), TABLE_MAP and WRITE_ROWS, but
22 # won't have the XID for the transaction.
23 #
24 # After reconnecting to the master, if the slave is configured with
25 # GTID and auto positioning, the IO thread will request the whole
26 # transaction again.
27 #
28 # The test case will then sync the slave with the master and verify
29 # that all data was correctly applied on slave.
30 #
31
32 # this test relies on a debug point that is triggered after
33 # the IO thread encounters a write rows log event. This is
34 # impossible with compression, since the IO thread will not
35 # parse transaction payload events
36 --source include/not_binlog_transaction_compression_on.inc
37
38 --source include/not_group_replication_plugin.inc
39 # This test case uses a debug point based on RBR
40 --source include/have_binlog_format_row.inc
41 --source include/have_debug.inc
42 --source include/master-slave.inc
43
44 --source include/rpl_connection_slave.inc
45 # Prepare the slave IO thread to stop after queuing a WRITE_ROWS event
46 SET @save_debug=@@global.debug;
47 SET GLOBAL DEBUG= "+d,stop_io_after_reading_write_rows_log_event";
48
49 # Put some data in to the master
50 --source include/rpl_connection_master.inc
51 CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
52 # This transaction will be split
53 BEGIN;
54 INSERT INTO t1 (c1) VALUES (1);
55 COMMIT;
56 # This transaction will not be split
57 BEGIN;
58 INSERT INTO t1 (c1) VALUES (2);
59 COMMIT;
60
61 # Wait the slave IO thread to reach the debug point
62 --source include/rpl_connection_slave.inc
63 --source include/wait_for_slave_io_to_stop.inc
64 # Remove the debug point, so the IO thread will not stop after
65 # queuing a WRITE_ROWS event anymore
66 SET GLOBAL DEBUG= @save_debug;
67
68 # Restart slave I/O thread
69 --source include/start_slave_io.inc
70
71 # Sync the slave with the master
72 --source include/rpl_connection_master.inc
73 --source include/sync_slave_sql_with_master.inc
74
75 # Final data verification
76 --source include/rpl_connection_master.inc
77 --source include/sync_slave_sql_with_master.inc
78 --let diff_tables= master:t1, slave:t1
79 --source include/diff_tables.inc
80
81 # Cleanup
82 --source include/rpl_connection_master.inc
83 DROP TABLE t1;
84 --source include/rpl_end.inc