Debian Codegraph @

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

raw
1 --echo *** MDEV-6551: Some replication errors are ignored if slave_parallel_threads > 0 ***
2
3 --source include/have_innodb.inc
4 --source include/have_binlog_format_statement.inc
5 --source include/master-slave.inc
6
7 --connection server_2
8 --source include/stop_slave.inc
9 SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
10 SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
11 SET GLOBAL slave_parallel_threads=1;
12 CHANGE MASTER TO master_use_gtid=slave_pos;
13 CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
14 --source include/start_slave.inc
15
16 --connection server_1
17 ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
18 CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB;
19 SET gtid_domain_id=1;
20 INSERT INTO t2 VALUES (1);
21 SET gtid_domain_id=0;
22 SET gtid_domain_id=2;
23 INSERT INTO t2 VALUES (2);
24 SET gtid_domain_id=0;
25 INSERT INTO t2 VALUES (31);
26 --let $gtid1= `SELECT @@LAST_GTID`
27 --source include/save_master_gtid.inc
28
29 --connection server_2
30 --source include/sync_with_master_gtid.inc
31 --source include/stop_slave.inc
32 SET GLOBAL slave_parallel_threads= 0;
33 --source include/start_slave.inc
34
35 # Force a duplicate key error on the slave.
36 SET sql_log_bin= 0;
37 INSERT INTO t2 VALUES (32);
38 SET sql_log_bin= 1;
39
40 --connection server_1
41 INSERT INTO t2 VALUES (32);
42 --let $gtid2= `SELECT @@LAST_GTID`
43 # Rotate the binlog; the bug is triggered when the master binlog file changes
44 # after the event group that causes the duplicate key error.
45 FLUSH LOGS;
46 INSERT INTO t2 VALUES (33);
47 INSERT INTO t2 VALUES (34);
48 SELECT * FROM t2 WHERE a >= 30 ORDER BY a;
49 --source include/save_master_gtid.inc
50
51 --connection server_2
52 --let $slave_sql_errno= 1062
53 --source include/wait_for_slave_sql_error.inc
54
55 --connection server_2
56 --source include/stop_slave_io.inc
57 SET GLOBAL slave_parallel_threads=10;
58 START SLAVE;
59
60 --let $slave_sql_errno= 1062
61 --source include/wait_for_slave_sql_error.inc
62
63 # Note: IO thread is still running at this point.
64 # The bug seems to have been that restarting the SQL thread after an error with
65 # the IO thread still running, somehow picks up a later relay log position and
66 # thus ends up skipping the failing event, rather than re-executing.
67
68 START SLAVE SQL_THREAD;
69 --let $slave_sql_errno= 1062
70 --source include/wait_for_slave_sql_error.inc
71
72 SELECT * FROM t2 WHERE a >= 30 ORDER BY a;
73
74 # Skip the duplicate error, so we can proceed.
75 --error ER_SLAVE_SKIP_NOT_IN_GTID
76 SET sql_slave_skip_counter= 1;
77 --source include/stop_slave_io.inc
78 --disable_query_log
79 eval SET GLOBAL gtid_slave_pos = REPLACE(@@gtid_slave_pos, "$gtid1", "$gtid2");
80 --enable_query_log
81 --source include/start_slave.inc
82 --source include/sync_with_master_gtid.inc
83
84 SELECT * FROM t2 WHERE a >= 30 ORDER BY a;
85
86 # Clean up.
87 --connection server_2
88 --source include/stop_slave.inc
89 SET GLOBAL slave_parallel_threads=@old_parallel_threads;
90 SET GLOBAL slave_parallel_mode=@old_parallel_mode;
91 --source include/start_slave.inc
92
93 --connection server_1
94 DROP TABLE t2;
95
96 --source include/rpl_end.inc