Debian Codegraph @

mysql-test/suite/rpl_nogtid/t/rpl_nogtid_rollback_on_anonymous_gtid.test

raw
1 # ==== Purpose ====
2 #
3 # This test will make the slave rollback an anonymous transactions.
4 #
5 # It will keep the SQL thread running to avoid the relay log to be purged
6 # in a CHANGE MASTER.
7 #
8 # Then, it will make the slave to replicate up to the middle of a transaction,
9 # will stop the I/O thread, do a CHANGE MASTER pointing to the begin of the
10 # transaction and restart the I/O thread.
11 #
12 # In this way, the relay log will have something like:
13 # ANONYMOUS_GTID, QUERY(BEGIN), QUERY(INSERT), QUERY(INSERT)
14 # ANONYMOUS_GTID, QUERY(BEGIN), QUERY(INSERT), QUERY(INSERT), QUERY(INSERT), XID
15 #
16 # It is expected that the SQL thread will rollback the partial transaction once
17 # reaching the second ANONYMOUS_GTID event.
18 #
19 # ==== Related Bugs and Worklogs ====
20 #
21 # BUG#25800025 SQL THREAD ERROR 1778 WHEN GTID SKIPPING PARTIAL TRX
22 #
23 # This test case requires SBR
24 --source include/have_debug.inc
25 --source include/have_debug_sync.inc
26 --source include/have_binlog_format_statement.inc
27 # This test case generates a situation that should not happen
28 # in normal slave operation (there is no retrieval of the transaction
29 # from the begin when MASTER_AUTO_POSITION = 0). Enabling this test
30 # case on MTS may hit some MTS asserts.
31 --source include/not_mts_replica_parallel_workers.inc
32 --source include/master-slave.inc
33
34 --let $master_uuid=`SELECT @@SERVER_UUID`
35 CREATE TABLE t1 (c1 INT PRIMARY KEY);
36
37 # Collect the master positions before the transaction
38 --let $master_file= query_get_value(SHOW MASTER STATUS, File, 1)
39 --let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
40 --source include/sync_slave_sql_with_master.inc
41 --source include/stop_slave_io.inc
42 CALL mtr.add_suppression('GTID_LOG_EVENT or ANONYMOUS_GTID_LOG_EVENT is not expected');
43 CALL mtr.add_suppression('An unexpected event sequence was detected by the IO thread');
44
45 --source include/rpl_connection_master.inc
46 BEGIN;
47 INSERT INTO t1 VALUES (1);
48 INSERT INTO t1 VALUES (2);
49 INSERT INTO t1 VALUES (3);
50 INSERT INTO t1 VALUES (4);
51 INSERT INTO t1 VALUES (5);
52 INSERT INTO t1 VALUES (6);
53 INSERT INTO t1 VALUES (7);
54 INSERT INTO t1 VALUES (8);
55 INSERT INTO t1 VALUES (9);
56 COMMIT;
57
58 # Make the I/O to stop in the middle of the transaction
59 # right after the second QUERY(INSERT)
60 --source include/rpl_connection_slave.inc
61 --let $rpl_after_received_events_action= stop
62 --let $rpl_event_count= 3
63 --let $rpl_count_only_event_type= Query
64 --source include/rpl_receive_event_count.inc
65
66 # Make the I/O thread to ask for the full transaction from beginning
67 # without purging the relay log (SQL thread is active).
68 --replace_result $master_file MASTER_FILE $master_pos MASTER_POS
69 --eval CHANGE REPLICATION SOURCE TO SOURCE_LOG_FILE='$master_file', SOURCE_LOG_POS=$master_pos
70
71 # Restart the I/O thread
72 --source include/start_slave_io.inc
73
74 # Sync slave with master
75 --source include/rpl_connection_master.inc
76 --source include/sync_slave_sql_with_master.inc
77
78 # Cleanup
79 --source include/rpl_connection_master.inc
80 DROP TABLE t1;
81 --source include/rpl_end.inc