Debian Codegraph @

mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test

raw
1 #
2 # Test the case where the cluster splits 3 ways . The master remains in the
3 # primary component and is able to commit its transaction.
4 #
5
6 --source include/galera_cluster.inc
7 --source include/have_innodb.inc
8
9 --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
10
11 # Save original auto_increment_offset values.
12 --let $node_1=node_1
13 --let $node_2=node_2
14 --let $node_3=node_3
15 --source ../galera/include/auto_increment_offset_save.inc
16
17 --connection node_1
18 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
19
20 #
21 # Begin a separate SR transaction on every node and confirm that each node
22 # has SR table entries for every transaction
23 #
24
25 SET SESSION wsrep_trx_fragment_size = 1;
26 SET AUTOCOMMIT=OFF;
27 START TRANSACTION;
28
29 INSERT INTO t1 VALUES (10);
30 INSERT INTO t1 VALUES (11);
31 INSERT INTO t1 VALUES (12);
32 INSERT INTO t1 VALUES (13);
33 INSERT INTO t1 VALUES (14);
34
35 SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
36
37 --connection node_2
38 --let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log
39 --source include/wait_condition.inc
40
41 SET SESSION wsrep_trx_fragment_size = 1;
42 SET AUTOCOMMIT=OFF;
43 START TRANSACTION;
44 INSERT INTO t1 VALUES (200);
45 INSERT INTO t1 VALUES (201);
46 INSERT INTO t1 VALUES (202);
47 INSERT INTO t1 VALUES (203);
48 INSERT INTO t1 VALUES (204);
49
50 --connection node_3
51 --let $wait_condition = SELECT COUNT(DISTINCT node_uuid) = 2 FROM mysql.wsrep_streaming_log
52 --source include/wait_condition.inc
53
54 SET SESSION wsrep_trx_fragment_size = 1;
55 SET AUTOCOMMIT=OFF;
56 START TRANSACTION;
57 INSERT INTO t1 VALUES (300);
58 INSERT INTO t1 VALUES (301);
59 INSERT INTO t1 VALUES (302);
60 INSERT INTO t1 VALUES (303);
61 INSERT INTO t1 VALUES (304);
62
63 --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
64 --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
65 --connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3
66
67 --connection node_1a
68 --let $wait_condition = SELECT COUNT(DISTINCT node_uuid) = 3 FROM mysql.wsrep_streaming_log
69 --source include/wait_condition.inc
70
71 #
72 # Isolate nodes #2 and #3 into separate non-primary components
73 #
74
75 --connection node_2a
76 SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
77
78 --connection node_3a
79 SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
80
81 --connection node_1a
82 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
83 --source include/wait_condition.inc
84
85 INSERT INTO t1 VALUES (20);
86 INSERT INTO t1 VALUES (21);
87 INSERT INTO t1 VALUES (22);
88 INSERT INTO t1 VALUES (23);
89 INSERT INTO t1 VALUES (24);
90
91 #
92 # Restore cluster
93 #
94
95 --connection node_2a
96 --source include/wsrep_wait_disconnect.inc
97 SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
98 --source include/galera_wait_ready.inc
99
100 --connection node_3a
101 --source include/wsrep_wait_disconnect.inc
102 SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
103 --source include/galera_wait_ready.inc
104
105 --connection node_1a
106 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
107 --source include/wait_condition.inc
108 --let $node_1_gcomm_uuid = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_gcomm_uuid'`
109
110 --connection node_2a
111 --source include/wait_condition.inc
112
113 --connection node_3a
114 --source include/wait_condition.inc
115
116
117 #
118 # Confirm that the rejoined nodes only have node #1's transaction in their SR tables
119 #
120
121 --connection node_2
122 --error ER_LOCK_DEADLOCK
123 COMMIT;
124 SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
125 --disable_query_log
126 --eval SELECT DISTINCT node_uuid = '$node_1_gcomm_uuid' AS wsrep_gcomm_uuid_match FROM mysql.wsrep_streaming_log;
127 --enable_query_log
128
129 --connection node_3
130 --error ER_LOCK_DEADLOCK
131 COMMIT;
132 SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;
133 --disable_query_log
134 --eval SELECT DISTINCT node_uuid = '$node_1_gcomm_uuid' AS wsrep_gcomm_uuid_match FROM mysql.wsrep_streaming_log;
135 --enable_query_log
136
137 #
138 # Finalize transaction on node #1
139 #
140
141 --connection node_1
142 SET innodb_snapshot_isolation=OFF;
143 INSERT INTO t1 VALUES (30);
144 INSERT INTO t1 VALUES (31);
145 INSERT INTO t1 VALUES (32);
146 INSERT INTO t1 VALUES (33);
147 INSERT INTO t1 VALUES (34);
148 COMMIT;
149
150 #
151 # Confirm that transaction is replicated correctly and SR tables are empty at the end of the test
152 #
153
154 SELECT COUNT(*) = 15, MIN(f1) = 10, MAX(f1) = 34 FROM t1;
155 SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
156 SET AUTOCOMMIT=ON;
157
158 --connection node_2
159 COMMIT;
160 SELECT COUNT(*) = 15, MIN(f1) = 10, MAX(f1) = 34 FROM t1;
161 SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
162 SET AUTOCOMMIT=ON;
163
164 --connection node_3
165 COMMIT;
166 SELECT COUNT(*) = 15, MIN(f1) = 10, MAX(f1) = 34 FROM t1;
167 SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
168 SET AUTOCOMMIT=ON;
169
170 DROP TABLE t1;
171
172 --connection node_1
173 CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");
174 --connection node_2
175 CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");
176 --connection node_3
177 CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");
178
179 --source ../galera/include/auto_increment_offset_restore.inc