Skip to content

Commit eba9189

Browse files
author
Jan Lindström
committed
Test case cleanups.
1 parent 51c8289 commit eba9189

File tree

5 files changed

+114
-1
lines changed

5 files changed

+114
-1
lines changed

mysql-test/suite/galera/galera_3nodes_as_slave.cnf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ server-id=1
1818
#sst_port=@OPT.port
1919

2020
log-slave-updates
21+
wsrep-on=1
2122

2223
innodb-autoinc-lock-mode=2
2324
default-storage-engine=innodb
@@ -39,6 +40,7 @@ server-id=2
3940
#sst_port=@OPT.port
4041

4142
log-slave-updates
43+
wsrep-on=1
4244

4345
innodb-autoinc-lock-mode=2
4446
default-storage-engine=innodb
@@ -60,6 +62,7 @@ server-id=3
6062
#sst_port=@OPT.port
6163

6264
log-slave-updates
65+
wsrep-on=1
6366

6467
innodb-autoinc-lock-mode=2
6568
default-storage-engine=innodb
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
1+
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
2+
connection node_2;
13
START SLAVE;
24
SET SESSION wsrep_sync_wait = 0;
5+
connection node_1;
36
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
7+
connection node_2;
48
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
9+
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
10+
connection node_3;
11+
connection node_1;
512
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
13+
connection node_2;
14+
connection node_3;
615
expected_error
716
1
17+
connection node_2;
818
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
19+
connection node_3;
20+
connection node_2;
921
START SLAVE;
22+
connection node_1;
1023
DROP TABLE t1;
24+
connection node_2;
1125
STOP SLAVE;
1226
RESET SLAVE ALL;
1327
CALL mtr.add_suppression("Slave SQL: Error 'Unknown command' on query");
1428
CALL mtr.add_suppression("Slave: Unknown command Error_code: 1047");
1529
CALL mtr.add_suppression("Transport endpoint is not connected");
1630
CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed, 'Deadlock found when trying to get lock; try restarting transaction', Error_code: 1213");
1731
CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047");
32+
connection node_1;
1833
RESET MASTER;

mysql-test/suite/galera/suite.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ push @::global_suppressions,
6666
qr(WSREP: Failed to remove page file .*),
6767
qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*),
6868
qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.|,
69+
qr|WSREP: Trying to continue unpaused monitor|,
6970
);
7071

7172
bless { };
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#
2+
# Test Galera as a slave to a MariaDB master using GTIDs
3+
#
4+
# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes
5+
# suite/galera/t/galera_as_slave_gtid.cnf has the GTID options
6+
#
7+
# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster
8+
#
9+
10+
--source include/have_innodb.inc
11+
--source include/galera_cluster.inc
12+
13+
# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
14+
# we open the node_3 connection here
15+
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
16+
17+
--connection node_2
18+
--disable_query_log
19+
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3;
20+
--enable_query_log
21+
START SLAVE;
22+
23+
--connection node_3
24+
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
25+
INSERT INTO t1 VALUES(1);
26+
27+
SELECT LENGTH(@@global.gtid_binlog_state) > 1;
28+
--let $gtid_binlog_state_node1 = `SELECT @@global.gtid_binlog_state;`
29+
30+
--connection node_1
31+
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
32+
--source include/wait_condition.inc
33+
34+
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
35+
--source include/wait_condition.inc
36+
37+
--connection node_2
38+
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
39+
--source include/wait_condition.inc
40+
41+
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
42+
--source include/wait_condition.inc
43+
44+
--disable_query_log
45+
46+
--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
47+
#--eval SELECT GTID_SUBSET('$gtid_executed_node1', @@global.gtid_executed) AS gtid_executed_equal;
48+
49+
--enable_query_log
50+
51+
--connection node_1
52+
SELECT COUNT(*) = 1 FROM t1;
53+
54+
--disable_query_log
55+
--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
56+
#--eval SELECT GTID_SUBSET('$gtid_executed_node1', @@global.gtid_executed) AS gtid_executed_equal;
57+
--enable_query_log
58+
59+
--connection node_3
60+
DROP TABLE t1;
61+
62+
#
63+
# Unfortunately without the sleep below the following statement fails with "query returned no rows", which
64+
# is difficult to understand given that it is an aggregate query. A "query execution was interrupted"
65+
# warning is also reported by MTR, which is also weird.
66+
#
67+
68+
--sleep 1
69+
70+
--connection node_1
71+
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
72+
--source include/wait_condition.inc
73+
74+
--connection node_2
75+
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
76+
--source include/wait_condition.inc
77+
78+
STOP SLAVE;
79+
RESET SLAVE ALL;
80+
81+
--echo #cleanup
82+
--connection node_1
83+
set global wsrep_on=OFF;
84+
reset master;
85+
set global wsrep_on=ON;
86+
87+
--connection node_2
88+
set global wsrep_on=OFF;
89+
reset master;
90+
set global wsrep_on=ON;
91+
92+
--connection node_3
93+
reset master;

mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ SELECT COUNT(*) = 0 FROM t1;
5353
--enable_query_log
5454

5555
--echo #cleanup
56+
--sleep 1
57+
5658
--connection node_1
5759
DROP TABLE t1;
5860

@@ -63,7 +65,6 @@ DROP TABLE t1;
6365
--connection node_3
6466
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
6567
--source include/wait_condition.inc
66-
6768
--connection node_1
6869
reset master;
6970

0 commit comments

Comments
 (0)