Debian Codegraph @

mysql-test/suite/rpl_gtid/t/rpl_gtid_transaction_split_across_relay_logs.test

raw
1 ###############################################################################
2 #BUG#16418100: ERROR "WHEN GTID_NEXT IS SET TO A GTID" ROW BASED REPLICATION
3 # Problem: When relay log info repository is configured to be persisted in a
4 # table and if a transaction that uses non-transactional engine is split across
5 # multiple relay logs, on relay log flush, partial transaction is
6 # committed. If the same situation occurs when gtid-mode=ON, it will cause that
7 # the same GTID will be used for more than one transaction and will cause
8 # ER_GTID_NEXT_TYPE_UNDEFINED_GTID error.
9 #
10 # Steps to reproduce:
11 # 1) Generate two write_row events for non-transactional table (MyISAM)
12 # (Default binlog_row_max_event_size= 8192). Insert two tuples with tuple
13 # size as 8192 bytes each. This will generate two write_row events.
14 # 2) With Auto_position=0, stopping IO thread after receving one write_row
15 # event will split the transaction across two relay logs.
16 # 3) If relaylog_info_repository=table, SQL thread should be able to apply
17 # these type of relaylogs.
18 ###############################################################################
19 # Need debug build to run this test
20 --source include/have_debug.inc
21 # Problem happens only in gtid mode
22 # Run only in row format
23 --source include/have_binlog_format_row.inc
24 # Test requires relay-log-info-repository = TABLE
25 --source include/not_relay_log_info_file.inc
26 --source include/force_myisam_default.inc
27 --source include/have_myisam.inc
28 --source include/not_rpl_gtid_only.inc
29
30 # Disable auto position protocol
31 --let use_gtids=0
32 --let $rpl_skip_start_slave= 1
33 --let $rpl_topology= 1->2->3
34 --source include/rpl_init.inc
35
36 --let $rpl_connection_name= server_1
37 --source include/rpl_connection.inc
38
39 # Non-transactional table (MyISAM engine)
40 CREATE TABLE t1 (i VARCHAR(8192)) ENGINE=MyISAM;
41
42 # Two tuples that will generate two write_row events.
43 INSERT INTO t1 VALUES(repeat('a',8192)), (repeat('b', 8192));
44
45 --let $rpl_connection_name= server_2
46 --source include/rpl_connection.inc
47 # Set simulation point to restart IO thread, so that the transaction
48 # is split across the relay logs.
49 SET @saved_debug=@@GLOBAL.debug;
50 SET GLOBAL debug="+d,stop_io_after_reading_write_rows_log_event";
51 START SLAVE IO_THREAD;
52 --source include/wait_for_slave_io_to_stop.inc
53 SET GLOBAL debug=@saved_debug;
54
55 # Make sure there are no replication issues
56 --disable_warnings
57 START SLAVE;
58 --enable_warnings
59
60 --let $rpl_connection_name= server_3
61 --source include/rpl_connection.inc
62 --disable_warnings
63 START SLAVE;
64 --enable_warnings
65
66 --let $rpl_connection_name= server_1
67 --source include/rpl_connection.inc
68 --source include/rpl_sync.inc
69
70 --let $diff_tables= server_1:t1, server_2:t1, server_3:t1
71 --source include/diff_tables.inc
72
73 # Assert that relay log info pos is stored on table
74 --let $rpl_connection_name= server_2
75 --source include/rpl_connection.inc
76 --let $sql_thread_pos=query_get_value('SHOW SLAVE STATUS', Exec_Master_Log_Pos, 1)
77 --let $sql_thread_file=query_get_value('SHOW SLAVE STATUS', Relay_Master_Log_File, 1)
78 --let $assert_cond= Master_log_pos = $sql_thread_pos FROM mysql.slave_relay_log_info
79 --let $assert_text= SQL thread position should be updated to after the split transaction
80 --source include/assert.inc
81 --let $assert_cond= Master_log_name = "$sql_thread_file" FROM mysql.slave_relay_log_info
82 --let $assert_text= SQL thread file should be updated to after the split transaction
83 --source include/assert.inc
84
85 # Cleanup
86 --let $rpl_connection_name= server_1
87 --source include/rpl_connection.inc
88 DROP TABLE t1;
89 --source include/rpl_end.inc