summaryrefslogtreecommitdiff
path: root/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test
blob: ef5bc7dd9232b1d748d66b3619c5e70fc506c589 (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
#
# Test the operation of pc.bootstrap 
#

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

call mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\).*");

CREATE TABLE t1 (f1 INTEGER);

# Force all nodes to become non-primary
--connection node_1
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';

--connection node_2
SET SESSION wsrep_sync_wait=0;
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc

SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';

--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
SET SESSION wsrep_sync_wait=0;
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc

SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';

# Node #2 should be non-primary
SET SESSION wsrep_sync_wait = 0;
--let $wait_condition = SELECT variable_value = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_cluster_status';
--source include/wait_condition.inc

# Signal node #2 to bootstrap
--connection node_2
SET GLOBAL wsrep_provider_options = 'pc.bootstrap=1';

# Wait until node becomes available for queries again
--source include/wait_until_connected_again.inc

# Node #2 should now be a primary of a 1-node cluster

SHOW STATUS LIKE 'wsrep_cluster_size';
SHOW STATUS LIKE 'wsrep_cluster_status';

# Perform an insert on node #2
INSERT INTO t1 VALUES (1);

# Reconnect all nodes 
--connection node_2
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';

--source include/wait_until_connected_again.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc


--connection node_1
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
--source include/wait_until_connected_again.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc


--connection node_3
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';

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

# Check that all nodes have the same view of the database

--connection node_1
SELECT COUNT(*) FROM t1;

--connection node_2
SELECT COUNT(*) FROM t1;

--connection node_3
SELECT COUNT(*) FROM t1;

# Test cleanup
DROP TABLE t1;