summaryrefslogtreecommitdiff
path: root/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test
blob: fb3af2cd25db73d9d1677a1e7f3b8a06369ae083 (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
#
# 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
--source include/have_innodb.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

SHOW CREATE TABLE mysql.wsrep_cluster;
SHOW CREATE TABLE mysql.wsrep_cluster_members;
#disabled SHOW CREATE TABLE mysql.wsrep_member_history;

# Checks for the wsrep_cluster table

SELECT COUNT(*) = 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(*) = 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(*) = 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;

# Checks for the wsrep_cluster_member_history table

#disabled SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_member_history;
#disabled SELECT COUNT(*) = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size') FROM mysql.wsrep_cluster_member_history;
SELECT COUNT(*) = 1 FROM mysql.wsrep_cluster_members WHERE node_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_gcomm_uuid');

#disabled SELECT last_view_id = (SELECT view_id FROM mysql.wsrep_cluster) FROM mysql.wsrep_cluster_member_history;
#disabled SELECT last_view_seqno = (SELECT view_seqno FROM mysql.wsrep_cluster) FROM mysql.wsrep_cluster_member_history;
#disabled SELECT node_incoming_address LIKE '127.0.0.1:%' from mysql.wsrep_cluster_member_history;
#disabled SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster_member_history;

--connection node_2
--source include/shutdown_mysqld.inc

--connection node_1
--source include/wait_until_connected_again.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(*) = 2 FROM mysql.wsrep_cluster_members;
#disabled SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_member_history;
#disabled SELECT COUNT(*) = 2 FROM mysql.wsrep_cluster_member_history WHERE last_view_id = (SELECT MAX(last_view_id) FROM mysql.wsrep_cluster_member_history);

--connection node_2
let $restart_noprint=2;
--source include/start_mysqld.inc
--source include/wait_until_connected_again.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(*) = 3 FROM mysql.wsrep_cluster_members;
#disabled SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_member_history WHERE last_view_id = (SELECT MAX(last_view_id) FROM mysql.wsrep_cluster_member_history);

--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(*) = 3 FROM mysql.wsrep_cluster_members;
#disabled SELECT COUNT(*) = 3 FROM mysql.wsrep_cluster_member_history WHERE last_view_id = (SELECT MAX(last_view_id) FROM mysql.wsrep_cluster_member_history);

--source ../galera/include/auto_increment_offset_restore.inc

--connection node_1
CALL mtr.add_suppression("SYNC message from member");

--connection node_2
CALL mtr.add_suppression("SYNC message from member");

--connection node_3
CALL mtr.add_suppression("SYNC message from member");