Debian Codegraph @

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

raw
1 --source include/have_innodb.inc
2 --source include/have_debug.inc
3 --source include/master-slave.inc
4
5 --disable_query_log
6 call mtr.add_suppression("InnoDB: Transaction was aborted due to ");
7 --enable_query_log
8
9 --echo MDEV-31655: Parallel replication deadlock victim preference code erroneously removed
10 # The problem was that InnoDB would choose the wrong deadlock victim.
11 # Create a lot of transactions that can cause deadlocks, and use error
12 # injection to check that the first transactions in each group is never
13 # selected as deadlock victim.
14 --let $rows= 10
15 --let $transactions= 5
16 --let $gcos= 10
17
18 --connection server_1
19 ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
20 CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
21 BEGIN;
22 --disable_query_log
23 --let $i= 0
24 while ($i < 10) {
25 eval INSERT INTO t1 VALUES ($i, 0);
26 inc $i;
27 }
28 --enable_query_log
29 COMMIT;
30 --source include/save_master_gtid.inc
31
32 --connection server_2
33 --source include/sync_with_master_gtid.inc
34 --source include/stop_slave.inc
35 SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
36 SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
37 eval set @@global.slave_parallel_threads= $transactions;
38 set @@global.slave_parallel_mode= conservative;
39 SET @old_dbug= @@GLOBAL.debug_dbug;
40 # This error injection will allow no retries for GTIDs divisible by 1000.
41 SET GLOBAL debug_dbug= "+d,rpl_mdev31655_zero_retries";
42
43 --connection server_1
44 SET @old_dbug= @@SESSION.debug_dbug;
45 SET SESSION debug_dbug="+d,binlog_force_commit_id";
46
47 --let $j= 1
48 while ($j <= $gcos) {
49 eval SET @commit_id= $j+1000;
50 --let $i= 0
51 while ($i < $transactions) {
52 --disable_query_log
53 eval SET SESSION gtid_seq_no= 1000 + 1000*$j + $i;
54 BEGIN;
55 --let $k= 0
56 while ($k < $rows) {
57 eval UPDATE t1 SET b=b+1 WHERE a=(($i+$k) MOD $rows);
58 inc $k;
59 }
60 COMMIT;
61 --enable_query_log
62 inc $i;
63 }
64 inc $j;
65 }
66
67 SET SESSION debug_dbug= @old_dbug;
68 SELECT COUNT(*), SUM(a*100*b) FROM t1;
69
70 --source include/save_master_gtid.inc
71
72 --connection server_2
73 --source include/start_slave.inc
74 --source include/sync_with_master_gtid.inc
75 SET GLOBAL debug_dbug= @old_dbug;
76 SELECT COUNT(*), SUM(a*100*b) FROM t1;
77
78
79 # Clean up.
80 --connection server_2
81 --source include/stop_slave.inc
82 SET GLOBAL slave_parallel_threads=@old_parallel_threads;
83 SET GLOBAL slave_parallel_mode=@old_parallel_mode;
84 --source include/start_slave.inc
85
86 --connection server_1
87 DROP TABLE t1;
88
89 --source include/rpl_end.inc