1#
2# Shut down slave (node #2) while an SR transaction is in progress
3#
4
5--source include/galera_cluster.inc
6
7# Save original auto_increment_offset values.
8--let $node_1=node_1
9--let $node_2=node_2
10--source ../galera/include/auto_increment_offset_save.inc
11
12--connection node_1
13CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE = InnoDB;
14
15# We start two transactions on the master so that we can commit one while the slave
16# is down and commit the other after the slave has rejoined
17
18--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
19--connection node_1a
20SET AUTOCOMMIT=OFF;
21SET SESSION wsrep_trx_fragment_size=1;
22START TRANSACTION;
23INSERT INTO t1 VALUES (11),(12),(13);
24
25--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1
26--connection node_1b
27SET AUTOCOMMIT=OFF;
28SET SESSION wsrep_trx_fragment_size=1;
29START TRANSACTION;
30INSERT INTO t1 VALUES (21),(22),(23);
31
32--connection node_2
33--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
34--source include/wait_condition.inc
35
36--source include/shutdown_mysqld.inc
37
38--connection node_1
39--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
40--source include/wait_condition.inc
41
42# Commit one transaction while the slave is down
43--connection node_1a
44INSERT INTO t1 VALUES (14),(15),(16);
45COMMIT;
46
47# Restart slave
48--connection node_2
49--source include/start_mysqld.inc
50
51# Confirm SR table on slave has entries
52SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
53SELECT COUNT(*) AS EXPECT_6 FROM t1 WHERE f1 IN (11,12,13,14,15,16);
54
55# Commit the second transaction on master after the slave has rejoined
56--connection node_1b
57INSERT INTO t1 VALUES (24),(25),(26);
58COMMIT;
59
60# Confirm that SR table on slave is empty
61--connection node_2
62SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
63SELECT COUNT(*) AS EXPECT_12 FROM t1;
64
65# SR table on master should be empty too
66--connection node_1
67SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
68
69DROP TABLE t1;
70
71# Restore original auto_increment_offset values.
72--source ../galera/include/auto_increment_offset_restore.inc
73