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

91 lines
3.3 KiB
Text

#
# Test the operation of pc.bootstrap
#
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
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 GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
--sleep 10
# 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';
--sleep 10
--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';
--sleep 10
--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;