| 1 |
# |
| 2 |
# Test the following sequence of events: |
| 3 |
# |
| 4 |
# 1. issue a remote transaction |
| 5 |
# 2. applier is blocked from applying the transaction locally using apply_monitor_slave_enter_sync |
| 6 |
# 3. FTWRL is issued and blocks in ApplyOrder>::drain_common |
| 7 |
# 4. applier is unblocked |
| 8 |
# 5. remote transaction is applied |
| 9 |
# 6. FTWRL is granted |
| 10 |
# |
| 11 |
|
| 12 |
--source include/galera_cluster.inc |
| 13 |
--source include/have_innodb.inc |
| 14 |
--source include/have_debug_sync.inc |
| 15 |
--source include/galera_have_debug_sync.inc |
| 16 |
|
| 17 |
--connection node_1 |
| 18 |
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; |
| 19 |
|
| 20 |
--connection node_2 |
| 21 |
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1' |
| 22 |
--source include/wait_condition.inc |
| 23 |
--let $galera_sync_point = apply_monitor_slave_enter_sync |
| 24 |
--source include/galera_set_sync_point.inc |
| 25 |
|
| 26 |
--connection node_1 |
| 27 |
INSERT INTO t1 VALUES (1); |
| 28 |
|
| 29 |
--connection node_2 |
| 30 |
SET SESSION wsrep_sync_wait = 0; |
| 31 |
|
| 32 |
# Wait until applier has blocked |
| 33 |
--source include/galera_wait_sync_point.inc |
| 34 |
|
| 35 |
SELECT COUNT(*) AS EXPECT_0 FROM t1; |
| 36 |
|
| 37 |
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 |
| 38 |
--connection node_2a |
| 39 |
--send FLUSH TABLES WITH READ LOCK; |
| 40 |
|
| 41 |
--connection node_2 |
| 42 |
--sleep 1 |
| 43 |
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE = 'Init' OR STATE = 'starting') AND INFO = 'FLUSH TABLES WITH READ LOCK' |
| 44 |
--source include/wait_condition.inc |
| 45 |
|
| 46 |
--source include/galera_clear_sync_point.inc |
| 47 |
--source include/galera_signal_sync_point.inc |
| 48 |
|
| 49 |
--connection node_2a |
| 50 |
--reap |
| 51 |
|
| 52 |
--connection node_2 |
| 53 |
|
| 54 |
SET SESSION lock_wait_timeout = 1; |
| 55 |
SET SESSION innodb_lock_wait_timeout=1; |
| 56 |
SET SESSION wait_timeout=1; |
| 57 |
|
| 58 |
--error ER_LOCK_WAIT_TIMEOUT |
| 59 |
INSERT INTO t1 VALUES (2); |
| 60 |
|
| 61 |
--connection node_2a |
| 62 |
UNLOCK TABLES; |
| 63 |
|
| 64 |
--connection node_2 |
| 65 |
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1 |
| 66 |
--source include/wait_condition.inc |
| 67 |
SELECT COUNT(*) AS EXPECT_1 FROM t1; |
| 68 |
INSERT INTO t1 VALUES (3); |
| 69 |
|
| 70 |
--connection node_1 |
| 71 |
SELECT COUNT(*) AS EXPECT_2 FROM t1; |
| 72 |
DROP TABLE t1; |