mariadb/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test
2024-07-09 11:56:47 +02:00

101 lines
3.7 KiB
Text

#
# 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 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
--connection node_3
# Isolate 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';
CALL mtr.add_suppression("WSREP: Vote 0 \\(success\\) on .* is inconsistent with group\\. Leaving cluster\\.");
--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;
--let $node_3=node_3
--let $auto_increment_offset_node_3 = 3;
--let $node_4=node_4
--let $auto_increment_offset_node_4 = 4;
--source suite/galera/include/auto_increment_offset_restore.inc
--disconnect node_3
--disconnect node_4