summaryrefslogtreecommitdiff
path: root/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test
blob: 869b559ada89568f9b79cca7a9f1dbf8c457739b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#
# Test the case where a node that dropped prior to an inconsistency vote is
# able to rejoin via IST after the vote is complete
#

--source include/galera_cluster.inc
--source include/big_test.inc

# Connect to extra nodes
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4

# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--let $node_3=node_3
--let $node_4=node_4
--source include/auto_increment_offset_save.inc

# Isolate node #3
--connection node_3
SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';

# Wait for node #3 to leave cluster
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc

# Introduce inconsistency on node #4
--connection node_4
SET SESSION wsrep_on=OFF;
CREATE TABLE t1 (f1 INTEGER);
SET SESSION wsrep_on=ON;
DROP TABLE t1;

# Wait for node #4 to be voted out
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
# Do some more stuff on the cluster to add to the IST stream
CREATE TABLE t2 (f1 INTEGER);

# Rejoin node #3
--connection node_3
SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
--source include/galera_wait_ready.inc

--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc

--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc

# Confirm that all is good
--connection node_3
SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';

# Rejoin node #4
--connection node_4
SET SESSION wsrep_on=OFF;
--source include/kill_galera.inc
--sleep 1
--echo Starting mysqld
--source include/start_mysqld.inc

--connection node_1
# Confirm node #4 has rejoined
--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc

# Confirm that all is good and all nodes have identical data
SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");

--connection node_2
SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");

--connection node_3
SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';

--connection node_4
SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
CALL mtr.add_suppression("WSREP: Vote 0 \\(success\\) on .* is inconsistent with group. Leaving cluster.");

DROP TABLE t2;

--source include/auto_increment_offset_restore.inc