Debian Codegraph @

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

raw
1 --echo *** MDEV-7929: record_gtid() for non-transactional event group calls wakeup_subsequent_commits() too early, causing slave hang. ***
2
3 --source include/have_innodb.inc
4 --source include/have_debug.inc
5 --source include/have_debug_sync.inc
6 --source include/master-slave.inc
7
8 --connection server_2
9 SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
10 --source include/stop_slave.inc
11 SET GLOBAL slave_parallel_threads=10;
12 CHANGE MASTER TO master_use_gtid=slave_pos;
13 --source include/start_slave.inc
14
15 --connection server_1
16 ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
17 CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM;
18 CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
19 --save_master_pos
20
21 --connection server_2
22 --sync_with_master
23 --source include/stop_slave.inc
24 SET @old_dbug= @@GLOBAL.debug_dbug;
25 SET GLOBAL debug_dbug= '+d,inject_record_gtid_serverid_100_sleep';
26
27 --connection server_1
28 # Inject two group commits. The bug was that record_gtid for a
29 # non-transactional event group would commit its own transaction, which would
30 # cause ha_commit_trans() to call wakeup_subsequent_commits() too early. This
31 # in turn lead to access to freed group_commit_orderer object, losing a wakeup
32 # and causing slave threads to hang.
33 # We inject a small sleep in the corresponding record_gtid() to make the race
34 # easier to hit.
35
36 SET @old_dbug= @@SESSION.debug_dbug;
37 SET SESSION debug_dbug="+d,binlog_force_commit_id";
38
39 # Group commit with cid=10010, two event groups.
40 SET @old_server_id= @@SESSION.server_id;
41 SET SESSION server_id= 100;
42 SET @commit_id= 10010;
43 ALTER TABLE t1 COMMENT "Hulubulu!";
44 SET SESSION server_id= @old_server_id;
45 INSERT INTO t3 VALUES (130, 0);
46
47 # Group commit with cid=10011, one event group.
48 SET @commit_id= 10011;
49 INSERT INTO t3 VALUES (131, 0);
50
51 SET SESSION debug_dbug=@old_dbug;
52
53 SELECT * FROM t3 WHERE a >= 130 ORDER BY a;
54 --source include/save_master_gtid.inc
55
56 --connection server_2
57 --source include/start_slave.inc
58 --source include/sync_with_master_gtid.inc
59
60 SELECT * FROM t3 WHERE a >= 130 ORDER BY a;
61
62 # Clean up.
63 --source include/stop_slave.inc
64 SET GLOBAL debug_dbug= @old_dbug;
65 SET GLOBAL slave_parallel_threads=@old_parallel_threads;
66 --source include/start_slave.inc
67
68 --connection server_1
69 DROP TABLE t1,t3;
70
71 --source include/rpl_end.inc
72