Debian Codegraph @

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

raw
1 #
2 # Test Galera as a slave to a MySQL master
3 #
4 # The galera/galera_2node_slave.cnf describes the setup of the nodes
5 # also, for this test, master server must have binlog_format=ROW
6 #
7
8 --source include/have_innodb.inc
9 --source include/have_log_bin.inc
10 --source include/galera_cluster.inc
11
12 # As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
13 # we open the node_3 connection here
14 --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
15 SELECT @@wsrep_on;
16
17 --connection node_1
18 --disable_query_log
19 --eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_SSL_VERIFY_SERVER_CERT=0, MASTER_PORT=$NODE_MYPORT_3;
20 --enable_query_log
21 START SLAVE;
22
23 # make sure master server has binlog_format=ROW
24 --connection node_3
25 SHOW VARIABLES LIKE 'binlog_format';
26
27 #
28 # test phase one, issue CTAS with empty source table
29 #
30
31 CREATE TABLE source (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
32
33 CREATE TABLE target AS SELECT * FROM source;
34
35 --connection node_1
36 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target';
37 --let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.TABLES
38 --source include/wait_condition_with_debug.inc
39
40 --connection node_2
41 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target';
42 --let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.TABLES
43 --source include/wait_condition_with_debug.inc
44
45 #
46 # test phase two, issue CTAS with populated source table
47 #
48 --connection node_3
49 DROP TABLE target;
50 INSERT INTO source VALUES(1);
51
52 CREATE TABLE target AS SELECT * FROM source;
53
54 --connection node_1
55 --let $wait_condition = SELECT COUNT(*) = 1 FROM target;
56 --source include/wait_condition.inc
57
58 --connection node_2
59 --let $wait_condition = SELECT COUNT(*) = 1 FROM target;
60 --source include/wait_condition.inc
61
62 --connection node_3
63 DROP TABLE source;
64 DROP TABLE target;
65
66 --connection node_2
67 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target';
68 --source include/wait_condition.inc
69 call mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on");
70 call mtr.add_suppression("WSREP: Failed to apply write set: gtid:");
71
72 --connection node_1
73 STOP SLAVE;
74 RESET SLAVE ALL;
75 call mtr.add_suppression("WSREP: unexpected async replication event: 0");
76
77 --connection node_3
78 RESET MASTER;