Debian Codegraph @

mysql-test/suite/rpl/include/mdev-31448_optimistic.inc

raw
1 --echo # MDEV-31448 OOO finish event group by killed worker
2 # The test demonstrates how a killed worker access gco lists
3 # in finish_event_group() out-of-order to fire
4 # DBUG_ASSERT(!tmp_gco->next_gco || tmp_gco->last_sub_id > sub_id);
5 # in the buggy version.
6
7 --echo # Initialize test data
8 --connection master
9 create table t1 (a int) engine=innodb;
10 create table t2 (a int) engine=innodb;
11
12 insert into t1 values (1);
13 --source include/save_master_gtid.inc
14
15 --connection slave
16 call mtr.add_suppression("Connection was killed");
17 call mtr.add_suppression("Can.t find record");
18
19 --source include/sync_with_master_gtid.inc
20 --source include/stop_slave.inc
21 set @save.slave_parallel_threads= @@global.slave_parallel_threads;
22 set @save.slave_parallel_mode= @@global.slave_parallel_mode;
23 set @@global.slave_parallel_threads= 3;
24 set @@global.slave_parallel_mode= OPTIMISTIC;
25
26 --connection slave1
27 begin;
28 update t1 set a=2 where a=1;
29
30 --connection master
31 set @old_dbug= @@session.debug_dbug;
32 set @@session.debug_dbug="+d,binlog_force_commit_id";
33
34 # GCO 1
35 set @commit_id= 10000;
36 # T1
37 update t1 set a=2 where a=1;
38
39 if (!$killed_trx_commits)
40 {
41 set @commit_id= 10001;
42 # T2
43 set statement skip_parallel_replication=1 for insert into t2 values (1);
44 }
45
46 if ($killed_trx_commits)
47 {
48 insert into t2 values (1);
49 }
50 # GCO 2
51 # T3
52 drop table t2;
53
54 --connection slave
55 --source include/start_slave.inc
56
57 --echo # wait for T1
58 # Wildcard for `state` as it depends on whether WSREP is compiled in or not.
59 --let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Update_rows_log_event::find_row(%' and command LIKE 'Slave_worker';
60 --source include/wait_condition.inc
61
62 --echo # wait for T2
63 --let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Waiting for prior transaction to commit%' and command LIKE 'Slave_worker';
64 --source include/wait_condition.inc
65 --let $t2_tid= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for prior transaction to commit%' and command LIKE 'Slave_worker'`
66 --echo # wait for T3
67 --let $wait_condition= SELECT count(*)=1 FROM information_schema.processlist WHERE state LIKE 'Waiting for prior transaction to start commit%' and command LIKE 'Slave_worker';
68 --source include/wait_condition.inc
69
70 --evalp kill $t2_tid
71 # give some little time for T2 to re-sink into the same state
72 --let $slave_param=Last_Errno
73 --let $slave_param_value=1927
74 --source include/wait_for_slave_param.inc
75 --connection slave1
76 commit;
77
78 --connection slave
79 --let $slave_sql_errno=1032
80 --source include/wait_for_slave_sql_error.inc
81
82 update t1 set a=1 where a=2;
83 set @@global.slave_parallel_threads = @save.slave_parallel_threads;
84 set @@global.slave_parallel_mode = @save.slave_parallel_mode;
85 --source include/start_slave.inc
86
87 --echo #
88 --echo # Cleanup
89 --connection master
90 drop table t1;
91 --source include/save_master_gtid.inc
92
93 --connection slave
94 --source include/sync_with_master_gtid.inc
95