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