summaryrefslogtreecommitdiff
path: root/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test
blob: d7b0f36551f231e49cc4135b3c3bda40d9fa7d5f (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#
# This test creates 2x3 nodes galera cluster.
#
#       A(1) <-> B(2) <-> C(3)     {Galera cluster 1}
#       |                          {Circular Async replication}
#       D(4) <-> E(5) <-> F(6)     {Galera cluster 2}
#

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

--connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5

--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
--connection node_4

--replace_result $NODE_MYPORT_1 NODE_MYPORT_1
--eval CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_1, master_use_gtid=current_pos;
START SLAVE;
--source include/wait_for_slave_to_start.inc

#
# CREATE TABLE & INSERT
#

--connection node_1

CREATE TABLE t1(c1 INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INTEGER);
INSERT INTO t1(c2) VALUES(1);

--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3

SELECT COUNT(*) = 1 FROM t1;

--connection node_1
--source include/save_master_gtid.inc

--connection node_4
--source include/sync_with_master_gtid.inc

SELECT COUNT(*) = 1 FROM t1;

--connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6
--connection node_6

SELECT COUNT(*) = 1 FROM t1;

#
# ALTER TABLE
#

--connection node_2

ALTER TABLE t1 ADD COLUMN t3 INTEGER;
--echo Node 2 column number AFTER ALTER
SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1';

--connection node_3

--echo Node 3 column number AFTER ALTER
SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1';

--connection node_1
--source include/save_master_gtid.inc

--connection node_4
--source include/sync_with_master_gtid.inc

--echo Node 4 column number AFTER ALTER
SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1';

--connection node_6

--echo Node 6 column number AFTER ALTER
SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1';

#
# OPTIMIZE TABLE
#

--connection node_2

--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
OPTIMIZE TABLE t1;

--connection node_1

--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
--source include/wait_condition.inc

--connection node_4

--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
--source include/wait_condition.inc

--connection node_6

--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
--source include/wait_condition.inc

#
# Cleanup
#

--connection node_1

DROP TABLE t1;

--connection node_4

STOP SLAVE;
RESET SLAVE;
SET GLOBAL wsrep_on = OFF;
RESET MASTER;
SET GLOBAL wsrep_on = ON;
SET GLOBAL GTID_SLAVE_POS="";

--connection node_1

SET GLOBAL wsrep_on = OFF;
RESET MASTER;
SET GLOBAL wsrep_on = ON;

--connection node_2

SET GLOBAL wsrep_on = OFF;
RESET MASTER;
SET GLOBAL wsrep_on = ON;

CALL mtr.add_suppression("Ignoring server id for non bootstrap node");

--connection node_3

SET GLOBAL wsrep_on = OFF;
RESET MASTER;
SET GLOBAL wsrep_on = ON;

CALL mtr.add_suppression("Ignoring server id for non bootstrap node");

--connection node_5

SET GLOBAL wsrep_on = OFF;
RESET MASTER;
SET GLOBAL wsrep_on = ON;

CALL mtr.add_suppression("Ignoring server id for non bootstrap node");

--connection node_6

SET GLOBAL wsrep_on = OFF;
RESET MASTER;
SET GLOBAL wsrep_on = ON;

CALL mtr.add_suppression("Ignoring server id for non bootstrap node");