Debian Codegraph @

mysql-test/suite/multi_source/gtid_slave_pos.result

raw
1 connect slave1,127.0.0.1,root,,,$SERVER_MYPORT_3;
2 connect master1,127.0.0.1,root,,,$SERVER_MYPORT_1;
3 connect master2,127.0.0.1,root,,,$SERVER_MYPORT_2;
4 connection slave1;
5 CHANGE MASTER 'slave1' TO master_port=MYPORT_1, master_host='127.0.0.1', master_user='root', master_ssl_verify_server_cert=0, master_use_gtid=slave_pos;
6 CHANGE MASTER 'slave2' TO master_port=MYPORT_2, master_host='127.0.0.1', master_user='root', master_ssl_verify_server_cert=0, master_use_gtid=slave_pos;
7 set default_master_connection = 'slave1';
8 START SLAVE;
9 include/wait_for_slave_to_start.inc
10 set default_master_connection = 'slave2';
11 START SLAVE;
12 include/wait_for_slave_to_start.inc
13 set default_master_connection = '';
14 connection master1;
15 SET GLOBAL gtid_domain_id= 1;
16 SET SESSION gtid_domain_id= 1;
17 CREATE TABLE t3 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB;
18 CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10));
19 INSERT INTO t1 VALUES (1, "initial");
20 INSERT INTO t3 VALUES (101, "initial 1");
21 include/save_master_gtid.inc
22 connection master2;
23 SET GLOBAL gtid_domain_id= 2;
24 SET SESSION gtid_domain_id= 2;
25 CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB;
26 INSERT INTO t2 VALUES (1, "initial");
27 connection slave1;
28 include/sync_with_master_gtid.inc
29 connection master2;
30 include/save_master_gtid.inc
31 connection slave1;
32 include/sync_with_master_gtid.inc
33 *** Add an innodb gtid_slave_pos table. It is not used yet as slaves are already running ***
34 SET sql_log_bin=0;
35 CREATE TABLE mysql.gtid_slave_pos_innodb LIKE mysql.gtid_slave_pos;
36 ALTER TABLE mysql.gtid_slave_pos_innodb ENGINE=InnoDB;
37 SET sql_log_bin=0;
38 connection master1;
39 INSERT INTO t3 VALUES (102, "secondary");
40 include/save_master_gtid.inc
41 connection slave1;
42 include/sync_with_master_gtid.inc
43 SELECT domain_id, max(seq_no) FROM mysql.gtid_slave_pos GROUP BY domain_id;
44 domain_id max(seq_no)
45 1 5
46 2 2
47 SELECT domain_id, max(seq_no) FROM mysql.gtid_slave_pos_innodb GROUP BY domain_id;
48 domain_id max(seq_no)
49 *** Restart one slave thread, the other keeps running. Now the new table is used ***
50 connection slave1;
51 set default_master_connection = 'slave1';
52 STOP SLAVE;
53 include/wait_for_slave_to_stop.inc
54 START SLAVE;
55 include/wait_for_slave_to_start.inc
56 connection master1;
57 INSERT INTO t1 VALUES (2, "followup");
58 include/save_master_gtid.inc
59 connection slave1;
60 include/sync_with_master_gtid.inc
61 connection master2;
62 INSERT INTO t2 VALUES (2, "secondary2");
63 include/save_master_gtid.inc
64 connection slave1;
65 include/sync_with_master_gtid.inc
66 SELECT domain_id, max(seq_no) FROM mysql.gtid_slave_pos GROUP BY domain_id;
67 domain_id max(seq_no)
68 1 6
69 2 2
70 SELECT domain_id, max(seq_no) FROM mysql.gtid_slave_pos_innodb GROUP BY domain_id;
71 domain_id max(seq_no)
72 2 3
73 *** Remove a gtid_slave_posXXX table, restart one slave ***
74 *** Get a warning that the change is not yet picked up ***
75 *** See that updates fail due to trying to use the missing table ***
76 connection slave1;
77 SET sql_log_bin=0;
78 DROP TABLE mysql.gtid_slave_pos_innodb;
79 SET sql_log_bin=1;
80 set default_master_connection = 'slave2';
81 STOP SLAVE;
82 include/wait_for_slave_to_stop.inc
83 START SLAVE;
84 include/wait_for_slave_to_start.inc
85 CALL mtr.add_suppression("The table mysql.gtid_slave_pos_innodb was removed.");
86 connection master2;
87 INSERT INTO t2 VALUES (3, "tertiary 2");
88 connection slave1;
89 include/wait_for_slave_sql_error.inc [errno=1942]
90 SELECT domain_id, max(seq_no) FROM mysql.gtid_slave_pos GROUP BY domain_id;
91 domain_id max(seq_no)
92 1 6
93 2 2
94 *** Stop both slaves, see that the drop of mysql.gtid_slave_pos_innodb is now picked up ***
95 connection slave1;
96 set default_master_connection = 'slave1';
97 STOP SLAVE;
98 include/wait_for_slave_to_stop.inc
99 set default_master_connection = 'slave2';
100 include/wait_for_slave_sql_error.inc [errno=1942]
101 STOP SLAVE;
102 include/wait_for_slave_io_to_stop.inc
103 set default_master_connection = 'slave1';
104 START SLAVE;
105 include/wait_for_slave_to_start.inc
106 connection master1;
107 INSERT INTO t1 VALUES (3, "more stuff");
108 include/save_master_gtid.inc
109 connection slave1;
110 include/sync_with_master_gtid.inc
111 set default_master_connection = 'slave2';
112 START SLAVE;
113 include/wait_for_slave_to_start.inc
114 connection master2;
115 include/save_master_gtid.inc
116 connection slave1;
117 include/sync_with_master_gtid.inc
118 SELECT * FROM t1 ORDER BY a;
119 a b
120 1 initial
121 2 followup
122 3 more stuff
123 SELECT * FROM t2 ORDER BY a;
124 a b
125 1 initial
126 2 secondary2
127 3 tertiary 2
128 SELECT * FROM t3 ORDER BY a;
129 a b
130 101 initial 1
131 102 secondary
132 SELECT domain_id, max(seq_no) FROM mysql.gtid_slave_pos GROUP BY domain_id;
133 domain_id max(seq_no)
134 1 7
135 2 4
136 connection master1;
137 DROP TABLE t1;
138 DROP TABLE t3;
139 connection master2;
140 DROP TABLE t2;
141 connection slave1;
142 SET GLOBAL gtid_domain_id=0;
143 STOP ALL SLAVES;
144 Warnings:
145 Note 1938 SLAVE 'slave1' stopped
146 Note 1938 SLAVE 'slave2' stopped
147 include/reset_master_slave.inc
148 disconnect slave1;
149 connection master1;
150 SET GLOBAL gtid_domain_id=0;
151 include/reset_master_slave.inc
152 disconnect master1;
153 connection master2;
154 SET GLOBAL gtid_domain_id=0;
155 include/reset_master_slave.inc
156 disconnect master2;