Debian Codegraph @

mysql-test/suite/galera_3nodes/t/galera_2_cluster.test

raw
1 #
2 # This test creates 2x3 nodes galera cluster.
3 #
4 # A(1) <-> B(2) <-> C(3) {Galera cluster 1}
5 # | {Circular Async replication}
6 # D(4) <-> E(5) <-> F(6) {Galera cluster 2}
7 #
8
9 --source include/big_test.inc
10 --source include/galera_cluster.inc
11 --source include/have_innodb.inc
12 --source include/force_restart.inc
13
14 --connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6
15 --connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5
16 --connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
17
18 --connection node_4
19
20 --disable_query_log
21 --eval CHANGE MASTER TO master_host='127.0.0.1', master_user='root', MASTER_SSL_VERIFY_SERVER_CERT=0, master_port=$NODE_MYPORT_1, master_use_gtid=current_pos;
22 --enable_query_log
23 START SLAVE;
24 --source include/wait_for_slave_to_start.inc
25
26 #
27 # CREATE TABLE & INSERT
28 #
29
30 --connection node_1
31
32 CREATE TABLE t1(c1 INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INTEGER);
33 INSERT INTO t1(c2) VALUES(1);
34
35 --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
36 --connection node_3
37
38 SELECT COUNT(*) = 1 FROM t1;
39
40 --connection node_1
41 --source include/save_master_gtid.inc
42
43 --connection node_4
44 --source include/sync_with_master_gtid.inc
45
46 SELECT COUNT(*) = 1 FROM t1;
47
48 --connection node_6
49
50 SELECT COUNT(*) = 1 FROM t1;
51
52 #
53 # ALTER TABLE
54 #
55
56 --connection node_2
57
58 ALTER TABLE t1 ADD COLUMN t3 INTEGER;
59 --echo Node 2 column number AFTER ALTER
60 SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1';
61
62 --connection node_3
63
64 --echo Node 3 column number AFTER ALTER
65 SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1';
66
67 --connection node_1
68 --source include/save_master_gtid.inc
69
70 --connection node_4
71 --source include/sync_with_master_gtid.inc
72
73 --echo Node 4 column number AFTER ALTER
74 SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1';
75
76 --connection node_6
77
78 --echo Node 6 column number AFTER ALTER
79 SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1';
80
81 #
82 # OPTIMIZE TABLE
83 #
84
85 --connection node_2
86 --let $wsrep_last_committed_before_2 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
87
88 --connection node_1
89 --let $wsrep_last_committed_before_1 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
90
91 --connection node_3
92 --let $wsrep_last_committed_before_3 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
93
94 --connection node_4
95 --let $wsrep_last_committed_before_4 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
96
97 --connection node_5
98 --let $wsrep_last_committed_before_5 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
99
100 --connection node_6
101 --let $wsrep_last_committed_before_6 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
102
103 --connection node_2
104 OPTIMIZE TABLE t1;
105 --let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_2 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
106 --source include/wait_condition.inc
107
108 --connection node_1
109 --let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_1 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
110 --source include/wait_condition.inc
111
112 --connection node_3
113 --let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_3 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
114 --source include/wait_condition.inc
115
116 --connection node_4
117 --let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_4 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
118 --source include/wait_condition.inc
119
120 --connection node_5
121 --let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_5 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
122 --source include/wait_condition.inc
123
124 --connection node_6
125 --let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_6 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
126 --source include/wait_condition.inc
127
128 #
129 # Cleanup
130 #
131
132 --connection node_1
133
134 DROP TABLE t1;
135
136 --connection node_4
137
138 STOP SLAVE;
139 RESET SLAVE;
140 SET GLOBAL wsrep_on = OFF;
141 RESET MASTER;
142 SET GLOBAL wsrep_on = ON;
143 --source include/wait_until_ready.inc
144 SET GLOBAL GTID_SLAVE_POS="";
145
146 --connection node_1
147
148 SET GLOBAL wsrep_on = OFF;
149 RESET MASTER;
150 SET GLOBAL wsrep_on = ON;
151 --source include/wait_until_ready.inc
152
153 --connection node_2
154
155 SET GLOBAL wsrep_on = OFF;
156 RESET MASTER;
157 SET GLOBAL wsrep_on = ON;
158 --source include/wait_until_ready.inc
159
160 --connection node_3
161
162 SET GLOBAL wsrep_on = OFF;
163 RESET MASTER;
164 SET GLOBAL wsrep_on = ON;
165 --source include/wait_until_ready.inc
166
167 --connection node_5
168
169 SET GLOBAL wsrep_on = OFF;
170 RESET MASTER;
171 SET GLOBAL wsrep_on = ON;
172 --source include/wait_until_ready.inc
173
174 --connection node_6
175
176 SET GLOBAL wsrep_on = OFF;
177 RESET MASTER;
178 SET GLOBAL wsrep_on = ON;
179 --source include/wait_until_ready.inc
180
181 connection node_1;
182 CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node");
183 CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since ");
184
185 connection node_2;
186 CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node");
187 CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since ");
188
189 connection node_3;
190 CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node");
191 CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since ");
192
193 connection node_4;
194 CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node");
195 CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since ");
196
197 connection node_5;
198 CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node");
199 CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since ");
200
201 connection node_6;
202 CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node");
203 CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since ");