Debian Codegraph @

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

raw
1 --source include/have_innodb.inc
2 --let $rpl_topology=1->2
3 --source include/rpl_init.inc
4
5 # Test various aspects of parallel replication.
6
7 --connection server_2
8 SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
9 --source include/stop_slave.inc
10 SET GLOBAL slave_parallel_threads=10;
11 SET @old_max_relay= @@GLOBAL.max_relay_log_size;
12 SET GLOBAL max_relay_log_size = 4096;
13 CHANGE MASTER TO master_use_gtid=slave_pos;
14 --source include/start_slave.inc
15
16 --connection server_1
17 ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
18 CREATE TABLE t1 (a int PRIMARY KEY, b VARCHAR(100)) ENGINE=InnoDB;
19 INSERT INTO t1 VALUES (1, "a");
20 --save_master_pos
21
22 --connection server_2
23 --sync_with_master
24
25 --echo *** Create a long transaction that will span a relay log file. ***
26 --connection server_1
27
28 # Add some transactions in separate domains, that will cause the need to
29 # have a multi-valued restart position in the relay log for the SQL thread.
30 SET @old_domain= @@gtid_domain_id;
31 SET gtid_domain_id=10;
32 INSERT INTO t1 VALUES (10000, "domain 10");
33 SET gtid_domain_id=20;
34 INSERT INTO t1 VALUES (20000, "domain 20");
35 SET gtid_domain_id=@old_domain;
36
37 BEGIN;
38 --echo [lots of inserts omitted]
39 --disable_query_log
40 --let $count = 500
41 while ($count) {
42 eval INSERT INTO t1 VALUES (1000+$count, REPEAT("hulubulu??!?", 8));
43 dec $count;
44 }
45 --enable_query_log
46 COMMIT;
47
48 --save_master_pos
49
50 --connection server_2
51 --sync_with_master
52
53 --connection server_1
54 # Now do another one, to make the inuse_relaylog proceed to somewhere inside
55 # the first large transaction.
56
57 BEGIN;
58 --echo [lots of inserts omitted]
59 --disable_query_log
60 --let $count = 500
61 while ($count) {
62 eval INSERT INTO t1 VALUES (2000+$count, REPEAT("hulubulu??!?", 8));
63 dec $count;
64 }
65 --enable_query_log
66 COMMIT;
67
68 --save_master_pos
69
70 --connection server_2
71 --sync_with_master
72
73
74 # Stop and restart the SQL thread only.
75 # The bug was that the SQL thread would restart at the start
76 # of a relay log file, which could be in the middle of an event group.
77 # This way, part of that event group could be wrongly re-applied.
78
79 --source include/stop_slave_sql.inc
80 START SLAVE SQL_THREAD;
81 --source include/wait_for_slave_to_start.inc
82
83
84 --connection server_1
85 INSERT INTO t1 VALUES (100000, "More stuffs.");
86 INSERT INTO t1 VALUES (100001, "And even more");
87 --save_master_pos
88
89 --connection server_2
90 --sync_with_master
91 SELECT * FROM t1 WHERE a >= 100000 ORDER BY a;
92
93
94 # Clean up.
95 --connection server_2
96 --source include/stop_slave.inc
97 SET GLOBAL slave_parallel_threads=@old_parallel_threads;
98 SET GLOBAL max_relay_log_size= @old_max_relay;
99 --source include/start_slave.inc
100
101 --connection server_1
102 ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria;
103 DROP TABLE t1;
104
105 --source include/rpl_end.inc