Debian Codegraph @

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

raw
1 #
2 # Test the operation of pc.bootstrap
3 #
4 --source include/big_test.inc
5 --source include/galera_cluster.inc
6 --source include/have_innodb.inc
7
8 call mtr.add_suppression("WSREP: gcs/src/gcs_core\\.cpp:core_handle_uuid_msg\\(\\)");
9
10 #
11 # Create connection node_3 and save auto increment variables.
12 #
13 --let $galera_connection_name = node_3
14 --let $galera_server_number = 3
15 --source include/galera_connect.inc
16
17 --let $node_1 = node_1
18 --let $node_2 = node_2
19 --let $node_3 = node_3
20 --source ../galera/include/auto_increment_offset_save.inc
21
22 --connection node_1
23
24 CREATE TABLE t1 (f1 INTEGER);
25
26 SET SESSION wsrep_sync_wait=0;
27 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
28 --source include/wait_condition.inc
29
30 # Force all nodes to become non-primary
31
32 SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
33
34 --connection node_2
35 SET SESSION wsrep_sync_wait=0;
36 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
37 --source include/wait_condition.inc
38
39 SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
40
41 --connection node_3
42 SET SESSION wsrep_sync_wait=0;
43 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
44 --source include/wait_condition.inc
45
46 SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
47
48 # Node #3 should be non-primary
49 --let $wait_condition = SELECT variable_value = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_cluster_status';
50 --source include/wait_condition.inc
51
52 --connection node_2
53 # Node #2 should be non-primary
54 --let $wait_condition = SELECT variable_value = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_cluster_status';
55 --source include/wait_condition.inc
56
57 # Signal node #2 to bootstrap
58 SET GLOBAL wsrep_provider_options = 'pc.bootstrap=1';
59
60 # Wait until node becomes available for queries again
61 --source include/wait_until_connected_again.inc
62
63 # Node #2 should now be a primary of a 1-node cluster
64
65 SHOW STATUS LIKE 'wsrep_cluster_size';
66 SHOW STATUS LIKE 'wsrep_cluster_status';
67
68 # Perform an insert on node #2
69 INSERT INTO t1 VALUES (1);
70
71 # Reconnect all nodes
72 --connection node_2
73 SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
74
75 --source include/wait_until_connected_again.inc
76 --let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
77 --source include/wait_condition.inc
78 --let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
79 --source include/wait_condition.inc
80 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
81 --source include/wait_condition.inc
82
83
84 --connection node_1
85 SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
86 --source include/wait_until_connected_again.inc
87 --let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
88 --source include/wait_condition.inc
89 --let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
90 --source include/wait_condition.inc
91 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
92 --source include/wait_condition.inc
93
94
95 --connection node_3
96 SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
97
98 --source include/wait_until_connected_again.inc
99 --let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
100 --source include/wait_condition.inc
101 --let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
102 --source include/wait_condition.inc
103 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
104 --source include/wait_condition.inc
105
106 # Check that all nodes have the same view of the database
107
108 --connection node_1
109 SELECT COUNT(*) FROM t1;
110
111 --connection node_2
112 SELECT COUNT(*) FROM t1;
113
114 --connection node_3
115 SELECT COUNT(*) FROM t1;
116
117 # Test cleanup
118 DROP TABLE t1;
119
120 #
121 # Restore auto increment variables.
122 #
123 --source ../galera/include/auto_increment_offset_restore.inc