| 1 |
--echo Performing State Transfer on a server that has been temporarily disconnected |
| 2 |
|
| 3 |
--connection node_1 |
| 4 |
CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; |
| 5 |
SET AUTOCOMMIT=OFF; |
| 6 |
START TRANSACTION; |
| 7 |
INSERT INTO t1 VALUES (1,'node1_committed_before'); |
| 8 |
INSERT INTO t1 VALUES (2,'node1_committed_before'); |
| 9 |
INSERT INTO t1 VALUES (3,'node1_committed_before'); |
| 10 |
INSERT INTO t1 VALUES (4,'node1_committed_before'); |
| 11 |
INSERT INTO t1 VALUES (5,'node1_committed_before'); |
| 12 |
COMMIT; |
| 13 |
|
| 14 |
--connection node_2 |
| 15 |
SET AUTOCOMMIT=OFF; |
| 16 |
START TRANSACTION; |
| 17 |
INSERT INTO t1 VALUES (6,'node2_committed_before'); |
| 18 |
INSERT INTO t1 VALUES (7,'node2_committed_before'); |
| 19 |
INSERT INTO t1 VALUES (8,'node2_committed_before'); |
| 20 |
INSERT INTO t1 VALUES (9,'node2_committed_before'); |
| 21 |
INSERT INTO t1 VALUES (10,'node2_committed_before'); |
| 22 |
COMMIT; |
| 23 |
|
| 24 |
--source suite/galera/include/galera_stop_replication.inc |
| 25 |
|
| 26 |
--connection node_1 |
| 27 |
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' |
| 28 |
--source include/wait_condition.inc |
| 29 |
|
| 30 |
SET AUTOCOMMIT=OFF; |
| 31 |
START TRANSACTION; |
| 32 |
INSERT INTO t1 VALUES (11,'node1_committed_during'); |
| 33 |
INSERT INTO t1 VALUES (12,'node1_committed_during'); |
| 34 |
INSERT INTO t1 VALUES (13,'node1_committed_during'); |
| 35 |
INSERT INTO t1 VALUES (14,'node1_committed_during'); |
| 36 |
INSERT INTO t1 VALUES (15,'node1_committed_during'); |
| 37 |
COMMIT; |
| 38 |
|
| 39 |
START TRANSACTION; |
| 40 |
INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); |
| 41 |
INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); |
| 42 |
INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); |
| 43 |
INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); |
| 44 |
INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); |
| 45 |
|
| 46 |
--connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 47 |
SET AUTOCOMMIT=OFF; |
| 48 |
START TRANSACTION; |
| 49 |
INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); |
| 50 |
INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); |
| 51 |
INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); |
| 52 |
INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); |
| 53 |
INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); |
| 54 |
|
| 55 |
--connection node_2 |
| 56 |
--source suite/galera/include/galera_start_replication.inc |
| 57 |
|
| 58 |
# |
| 59 |
# client connections were killed by provider load, so have to re-open here |
| 60 |
# |
| 61 |
--disconnect node_2 |
| 62 |
--connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2 |
| 63 |
--connection node_2 |
| 64 |
--enable_reconnect |
| 65 |
|
| 66 |
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' |
| 67 |
--source include/wait_condition.inc |
| 68 |
|
| 69 |
SET AUTOCOMMIT=OFF; |
| 70 |
START TRANSACTION; |
| 71 |
INSERT INTO t1 VALUES (26,'node2_committed_after'); |
| 72 |
INSERT INTO t1 VALUES (27,'node2_committed_after'); |
| 73 |
INSERT INTO t1 VALUES (28,'node2_committed_after'); |
| 74 |
INSERT INTO t1 VALUES (29,'node2_committed_after'); |
| 75 |
INSERT INTO t1 VALUES (30,'node2_committed_after'); |
| 76 |
COMMIT; |
| 77 |
|
| 78 |
--connection node_1 |
| 79 |
INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); |
| 80 |
INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); |
| 81 |
INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); |
| 82 |
INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); |
| 83 |
INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); |
| 84 |
COMMIT; |
| 85 |
|
| 86 |
SET AUTOCOMMIT=OFF; |
| 87 |
START TRANSACTION; |
| 88 |
INSERT INTO t1 VALUES (36,'node1_committed_after'); |
| 89 |
INSERT INTO t1 VALUES (37,'node1_committed_after'); |
| 90 |
INSERT INTO t1 VALUES (38,'node1_committed_after'); |
| 91 |
INSERT INTO t1 VALUES (39,'node1_committed_after'); |
| 92 |
INSERT INTO t1 VALUES (40,'node1_committed_after'); |
| 93 |
COMMIT; |
| 94 |
|
| 95 |
--connection node_1a_galera_st_disconnect_slave |
| 96 |
INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); |
| 97 |
INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); |
| 98 |
INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); |
| 99 |
INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); |
| 100 |
INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); |
| 101 |
ROLLBACK; |
| 102 |
|
| 103 |
--let $wait_condition = SELECT COUNT(*)=35 FROM t1 |
| 104 |
--source include/wait_condition.inc |
| 105 |
|
| 106 |
SET AUTOCOMMIT=ON; |
| 107 |
SET SESSION wsrep_sync_wait=15; |
| 108 |
SELECT COUNT(*) AS EXPECT_35 FROM t1; |
| 109 |
SELECT * FROM t1; |
| 110 |
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; |
| 111 |
|
| 112 |
--connection node_1 |
| 113 |
--let $wait_condition = SELECT COUNT(*)=35 FROM t1 |
| 114 |
--source include/wait_condition.inc |
| 115 |
|
| 116 |
SET AUTOCOMMIT=ON; |
| 117 |
SET SESSION wsrep_sync_wait=15; |
| 118 |
SELECT COUNT(*) AS EXPECT_35 FROM t1; |
| 119 |
SELECT * FROM t1; |
| 120 |
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; |
| 121 |
DROP TABLE t1; |
| 122 |
COMMIT; |