| 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_SSL_VERIFY_SERVER_CERT=0, 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 |
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; |
| 26 |
INSERT INTO t1 VALUES(1); |
| 27 |
|
| 28 |
#multi stmt trans |
| 29 |
begin; |
| 30 |
insert into t2 values(21); |
| 31 |
insert into t2 values(22); |
| 32 |
commit; |
| 33 |
|
| 34 |
SELECT @@global.gtid_binlog_state; |
| 35 |
|
| 36 |
--connection node_2 |
| 37 |
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; |
| 38 |
--source include/wait_condition.inc |
| 39 |
|
| 40 |
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1; |
| 41 |
--source include/wait_condition.inc |
| 42 |
|
| 43 |
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; |
| 44 |
--source include/wait_condition.inc |
| 45 |
|
| 46 |
--let $wait_condition = SELECT COUNT(*) = 2 FROM t2; |
| 47 |
--source include/wait_condition.inc |
| 48 |
|
| 49 |
INSERT INTO t1 VALUES(2); |
| 50 |
INSERT INTO t1 VALUES(3); |
| 51 |
SELECT @@global.gtid_binlog_state; |
| 52 |
|
| 53 |
--connection node_1 |
| 54 |
--let $wait_condition = SELECT COUNT(*) = 3 FROM t1; |
| 55 |
--source include/wait_condition.inc |
| 56 |
|
| 57 |
INSERT INTO t1 VALUES(4); |
| 58 |
SELECT @@global.gtid_binlog_state; |
| 59 |
|
| 60 |
--connection node_3 |
| 61 |
DROP TABLE t1,t2; |
| 62 |
|
| 63 |
# |
| 64 |
# Unfortunately without the sleep below the following statement fails with "query returned no rows", which |
| 65 |
# is difficult to understand given that it is an aggregate query. A "query execution was interrupted" |
| 66 |
# warning is also reported by MTR, which is also weird. |
| 67 |
# |
| 68 |
|
| 69 |
--sleep 1 |
| 70 |
|
| 71 |
--connection node_2 |
| 72 |
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; |
| 73 |
--source include/wait_condition.inc |
| 74 |
|
| 75 |
--connection node_1 |
| 76 |
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; |
| 77 |
--source include/wait_condition.inc |
| 78 |
|
| 79 |
--connection node_2 |
| 80 |
STOP SLAVE; |
| 81 |
RESET SLAVE ALL; |
| 82 |
SET GLOBAL wsrep_on=OFF; |
| 83 |
reset master; |
| 84 |
SET GLOBAL wsrep_on=ON; |
| 85 |
|
| 86 |
--connection node_1 |
| 87 |
SET GLOBAL wsrep_on=OFF; |
| 88 |
reset master; |
| 89 |
SET GLOBAL wsrep_on=ON; |
| 90 |
|
| 91 |
--connection node_3 |
| 92 |
reset master; |
| 93 |
|
| 94 |
--connection node_2 |
| 95 |
CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); |