mariadb/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test
2022-05-16 12:17:13 +03:00

81 lines
3.2 KiB
Text

#
# This test performs basic checks on the contents of the wsrep_schema
#
# wsrep_members_history checks are temporarily disabled until it
# can be made configurable.
#
--source include/galera_cluster.inc
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_1
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--let $node_3=node_3
--source ../galera/include/auto_increment_offset_save.inc
# Make the test fail if table structure has changed
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
SHOW CREATE TABLE mysql.wsrep_cluster;
SHOW CREATE TABLE mysql.wsrep_cluster_members;
# Checks for the wsrep_cluster table
SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster;
# Checks for the wsrep_cluster_members table
SELECT COUNT(*) AS EXPECT_3 FROM mysql.wsrep_cluster_members;
SELECT COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') FROM mysql.wsrep_cluster_members;
SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster_members WHERE node_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_gcomm_uuid');
SELECT node_incoming_address LIKE '127.0.0.1:%' from mysql.wsrep_cluster_members;
SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster_members;
--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_3 FROM mysql.wsrep_cluster_members;
--source include/shutdown_mysqld.inc
--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
SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster;
SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;
--connection node_2
let $restart_noprint=2;
--source include/start_mysqld.inc
--source include/wait_until_connected_again.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster;
SELECT COUNT(*) AS EXPECT_3 FROM mysql.wsrep_cluster_members;
--connection node_1
SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster;
SELECT COUNT(*) AS EXPECT_3 FROM mysql.wsrep_cluster_members;
--source ../galera/include/auto_increment_offset_restore.inc
--disconnect node_3