|
| 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; |
0 commit comments