Debian Codegraph @

mysql-test/suite/galera/t/galera_as_slave_gtid.inc

raw
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/have_log_bin.inc
12 --source include/galera_cluster.inc
13
14 # As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
15 # we open the node_3 connection here
16 --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
17
18 --connection node_2
19 --disable_query_log
20 --eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_SSL_VERIFY_SERVER_CERT=0, MASTER_PORT=$NODE_MYPORT_3;
21 --enable_query_log
22 START SLAVE;
23
24 --connection node_3
25 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
26 INSERT INTO t1 VALUES(1);
27
28 SELECT LENGTH(@@global.gtid_binlog_state) > 1;
29 --let $gtid_binlog_state_node1 = `SELECT @@global.gtid_binlog_state;`
30
31 --connection node_1
32 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
33 --source include/wait_condition.inc
34
35 --let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
36 --source include/wait_condition.inc
37
38 --connection node_2
39 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
40 --source include/wait_condition.inc
41
42 --let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
43 --source include/wait_condition.inc
44
45 --disable_query_log
46
47 --eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
48 #--eval SELECT GTID_SUBSET('$gtid_executed_node1', @@global.gtid_executed) AS gtid_executed_equal;
49
50 --enable_query_log
51
52 --connection node_1
53 SELECT COUNT(*) = 1 FROM t1;
54
55 --disable_query_log
56 --eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
57 #--eval SELECT GTID_SUBSET('$gtid_executed_node1', @@global.gtid_executed) AS gtid_executed_equal;
58 --enable_query_log
59
60 --connection node_3
61 DROP TABLE t1;
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_1
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_2
76 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
77 --source include/wait_condition.inc
78
79 STOP SLAVE;
80 RESET SLAVE ALL;
81
82 --echo #cleanup
83 --connection node_1
84 set global wsrep_on=OFF;
85 reset master;
86 set global wsrep_on=ON;
87
88 --connection node_2
89 set global wsrep_on=OFF;
90 reset master;
91 set global wsrep_on=ON;
92
93 --connection node_3
94 reset master;