| 1 |
connection node_3; |
| 2 |
connection node_2; |
| 3 |
connection node_1; |
| 4 |
connection node_1; |
| 5 |
connection node_2; |
| 6 |
connection node_3; |
| 7 |
connection node_2; |
| 8 |
SELECT @@wsrep_slave_threads = 8; |
| 9 |
@@wsrep_slave_threads = 8 |
| 10 |
1 |
| 11 |
connection node_1; |
| 12 |
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT); |
| 13 |
INSERT INTO t1 VALUES (1, 0),(2, 0),(3, 0),(4, 0),(5, 0),(6, 0),(7, 0),(8, 0); |
| 14 |
connection node_2; |
| 15 |
SET GLOBAL wsrep_provider_options='gcs.fc_limit=1K'; |
| 16 |
SET wsrep_on=OFF; |
| 17 |
DELETE FROM t1 WHERE f1 = 2; |
| 18 |
DELETE FROM t1 WHERE f1 = 4; |
| 19 |
SET wsrep_on=ON; |
| 20 |
LOCK TABLES t1 WRITE; |
| 21 |
connection node_1; |
| 22 |
UPDATE t1 SET f2 = 1 WHERE f1 = 1; |
| 23 |
UPDATE t1 SET f2 = 1 WHERE f1 = 2; |
| 24 |
UPDATE t1 SET f2 = 1 WHERE f1 = 3; |
| 25 |
UPDATE t1 SET f2 = 1 WHERE f1 = 4; |
| 26 |
UPDATE t1 SET f2 = 2 WHERE f1 = 4; |
| 27 |
/* dependent applier */ |
| 28 |
UPDATE t1 SET f2 = 3 WHERE f1 = 4; |
| 29 |
/* dependent applier */ |
| 30 |
UPDATE t1 SET f2 = 1 WHERE f1 = 5; |
| 31 |
UPDATE t1 SET f2 = 1 WHERE f1 = 6; |
| 32 |
UPDATE t1 SET f2 = 1 WHERE f1 = 7; |
| 33 |
UPDATE t1 SET f2 = 1 WHERE f1 = 8; |
| 34 |
connection node_2; |
| 35 |
# make sure all events landed to slave queue |
| 36 |
set wsrep_sync_wait=0; |
| 37 |
UNLOCK TABLES; |
| 38 |
SET SESSION wsrep_on = ON; |
| 39 |
SET SESSION wsrep_sync_wait = 15; |
| 40 |
SET SESSION wsrep_on = ON; |
| 41 |
SET SESSION wsrep_sync_wait = 15; |
| 42 |
connection node_1; |
| 43 |
SET SESSION wsrep_on = ON; |
| 44 |
SET SESSION wsrep_sync_wait = 15; |
| 45 |
SHOW STATUS LIKE 'wsrep_cluster_size'; |
| 46 |
Variable_name Value |
| 47 |
wsrep_cluster_size 2 |
| 48 |
SELECT * FROM t1; |
| 49 |
f1 f2 |
| 50 |
1 1 |
| 51 |
2 1 |
| 52 |
3 1 |
| 53 |
4 3 |
| 54 |
5 1 |
| 55 |
6 1 |
| 56 |
7 1 |
| 57 |
8 1 |
| 58 |
connection node_2; |
| 59 |
# Gracefully restart the node |
| 60 |
set wsrep_on=OFF; |
| 61 |
# restart |
| 62 |
DROP TABLE t1; |
| 63 |
connection node_1; |
| 64 |
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT); |
| 65 |
START TRANSACTION; |
| 66 |
INSERT INTO t1 VALUES (1, 0); |
| 67 |
INSERT INTO t1 VALUES (2, 0); |
| 68 |
INSERT INTO t1 VALUES (3, 0); |
| 69 |
INSERT INTO t1 VALUES (4, 0); |
| 70 |
INSERT INTO t1 VALUES (5, 0); |
| 71 |
INSERT INTO t1 VALUES (6, 0); |
| 72 |
INSERT INTO t1 VALUES (7, 0); |
| 73 |
INSERT INTO t1 VALUES (8, 0); |
| 74 |
COMMIT; |
| 75 |
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 INT); |
| 76 |
connection node_2; |
| 77 |
# Allow 1K slave queue without flow control |
| 78 |
SET GLOBAL wsrep_provider_options='gcs.fc_limit=1K'; |
| 79 |
# Introduce inconsistency |
| 80 |
SET wsrep_on=OFF; |
| 81 |
DROP TABLE t2; |
| 82 |
SET wsrep_on=ON; |
| 83 |
# set up sync point to ensure DROP TABLE replication order below |
| 84 |
SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync'; |
| 85 |
# Build up slave queue: |
| 86 |
LOCK TABLES t1 READ; |
| 87 |
connection node_1; |
| 88 |
UPDATE t1 SET f2 = 1 WHERE f1 = 1; |
| 89 |
UPDATE t1 SET f2 = 1 WHERE f1 = 2; |
| 90 |
UPDATE t1 SET f2 = 1 WHERE f1 = 3; |
| 91 |
UPDATE t1 SET f2 = 1 WHERE f1 = 4; |
| 92 |
UPDATE t1 SET f2 = 2 WHERE f1 = 4; |
| 93 |
/* dependent applier */; |
| 94 |
# interleave a failing statement |
| 95 |
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; |
| 96 |
connection node_2a; |
| 97 |
DROP TABLE t2;; |
| 98 |
# make sure DROP TABLE from above has replicated |
| 99 |
connection node_2; |
| 100 |
set wsrep_sync_wait=0; |
| 101 |
"Wait for DROP TABLE to replicate" |
| 102 |
SET SESSION wsrep_on = 0; |
| 103 |
SET SESSION wsrep_on = 1; |
| 104 |
SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync'; |
| 105 |
SET GLOBAL wsrep_provider_options = 'dbug='; |
| 106 |
"DROP TABLE replicated" |
| 107 |
connection node_1; |
| 108 |
UPDATE t1 SET f2 = 3 WHERE f1 = 4; |
| 109 |
/* dependent applier */ |
| 110 |
UPDATE t1 SET f2 = 1 WHERE f1 = 5; |
| 111 |
UPDATE t1 SET f2 = 1 WHERE f1 = 6; |
| 112 |
UPDATE t1 SET f2 = 1 WHERE f1 = 7; |
| 113 |
UPDATE t1 SET f2 = 1 WHERE f1 = 8; |
| 114 |
connection node_2; |
| 115 |
# make sure all events landed to slave queue |
| 116 |
UNLOCK TABLES; |
| 117 |
connection node_2a; |
| 118 |
ERROR 42S02: Unknown table 'test.t2' |
| 119 |
connection node_1; |
| 120 |
SET SESSION wsrep_on = ON; |
| 121 |
SET SESSION wsrep_sync_wait = 15; |
| 122 |
SHOW STATUS LIKE 'wsrep_cluster_size'; |
| 123 |
Variable_name Value |
| 124 |
wsrep_cluster_size 2 |
| 125 |
SELECT * FROM t1; |
| 126 |
f1 f2 |
| 127 |
1 1 |
| 128 |
2 1 |
| 129 |
3 1 |
| 130 |
4 3 |
| 131 |
5 1 |
| 132 |
6 1 |
| 133 |
7 1 |
| 134 |
8 1 |
| 135 |
connection node_2; |
| 136 |
set wsrep_on=OFF; |
| 137 |
SET SESSION wsrep_sync_wait = 15; |
| 138 |
# Wait for the node to shutdown replication |
| 139 |
SET SESSION wsrep_sync_wait = 15; |
| 140 |
# Gracefully restart the node |
| 141 |
# restart |
| 142 |
DROP TABLE t1; |
| 143 |
CALL mtr.add_suppression("Can't find record in 't1'"); |
| 144 |
CALL mtr.add_suppression("Update_rows_v1 apply failed"); |
| 145 |
CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus on"); |
| 146 |
CALL mtr.add_suppression("last left .* greater than drain seqno"); |
| 147 |
CALL mtr.add_suppression("WSREP: Failed to apply write set: "); |