Debian Codegraph @

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

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 # This test will replicate writes to MyISAM table and check that slave node is able
8 # to apply them.
9 # mysql.gtid_slave_pos table should be defined as innodb engine, original problem
10 # by writes to mysql.gtid_slave_pos, whereas the replicated transaction contained
11 # no innodb writes
12 #
13
14 --source include/have_innodb.inc
15 --source include/have_log_bin.inc
16 --source include/galera_cluster.inc
17 SELECT @@WSREP_ON;
18
19 # As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
20 # we open the node_3 connection here
21 --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
22 SELECT @@wsrep_on;
23
24 --connection node_1
25 # make sure gtid_slave_pos is of innodb engine, mtr does not currently provide that
26 ALTER TABLE mysql.gtid_slave_pos engine = InnoDB;
27
28 --disable_query_log
29 --eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_SSL_VERIFY_SERVER_CERT=0, MASTER_PORT=$NODE_MYPORT_3;
30 --enable_query_log
31 START SLAVE;
32
33 --connection node_3
34 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM;
35 INSERT INTO t1 VALUES(1);
36
37 SELECT LENGTH(@@global.gtid_binlog_state) > 1;
38 --let $gtid_binlog_state_node1 = `SELECT @@global.gtid_binlog_state;`
39
40 --connection node_1
41 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
42 --source include/wait_condition.inc
43
44 --let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
45 --source include/wait_condition.inc
46
47 SELECT COUNT(*) AS EXPECT_1 FROM t1;
48
49 # Note that MyISAM tables are not replicated by Galera so we do not here
50 # check node_2
51
52 --disable_query_log
53 --eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
54 --enable_query_log
55
56 --echo #cleanup
57 --connection node_3
58 DROP TABLE t1;
59
60 --connection node_1
61 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
62 --source include/wait_condition.inc
63
64 --connection node_2
65 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
66 --source include/wait_condition.inc
67
68 --connection node_3
69 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
70 --source include/wait_condition.inc
71 RESET MASTER;
72
73 --connection node_1
74 STOP SLAVE;
75 RESET SLAVE ALL;
76 SET GLOBAL WSREP_ON=OFF;
77 reset master;
78 SET GLOBAL WSREP_ON=ON;
79
80 --connection node_2
81 SET GLOBAL WSREP_ON=OFF;
82 reset master;
83 SET GLOBAL WSREP_ON=ON;
84
85 --connection node_3
86 RESET MASTER;