summaryrefslogtreecommitdiff
path: root/mysql-test/suite/galera/t/galera_as_slave_ctas.test
blob: 1a5e023b9818d3d1250dbb5439aaf94584afd912 (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
#
# Test Galera as a slave to a MySQL master
#
# The galera/galera_2node_slave.cnf describes the setup of the nodes
# also, for this test, master server must have binlog_format=ROW
#

--source include/have_innodb.inc

# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--source include/galera_cluster.inc

--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3

--connection node_2
--disable_query_log
--eval CHANGE MASTER TO  MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
--enable_query_log
START SLAVE;


# make sure master server has binlog_format=ROW
--connection node_1
SHOW VARIABLES LIKE 'binlog_format';

#
# test phase one, issue CTAS with empty source table
#
--connection node_1
CREATE TABLE source (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;

CREATE TABLE target AS SELECT * FROM source;

--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target';
--source include/wait_condition.inc

--connection node_3
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target';
--source include/wait_condition.inc

#
# test phase two, issue CTAS with populated source table
#
--connection node_1
DROP TABLE target;
INSERT INTO source VALUES(1);

CREATE TABLE target AS SELECT * FROM source;

--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM target;
--source include/wait_condition.inc

--connection node_3
--let $wait_condition = SELECT COUNT(*) = 1 FROM target;
--source include/wait_condition.inc

--connection node_1
DROP TABLE source;
DROP TABLE target;

--connection node_3
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target';
--source include/wait_condition.inc


--connection node_2
STOP SLAVE;
RESET SLAVE ALL;

--connection node_1
RESET MASTER;