| 1 |
# |
| 2 |
# Test the operation of TRUNCATE with concurrent DML. |
| 3 |
# The DML should be BF-aborted if the DDL arrives from another node |
| 4 |
# |
| 5 |
|
| 6 |
--source include/galera_cluster.inc |
| 7 |
--source include/have_debug_sync.inc |
| 8 |
--source include/have_debug.inc |
| 9 |
--source include/galera_have_debug_sync.inc |
| 10 |
|
| 11 |
# |
| 12 |
# INSERT and TRUNCATE on different nodes |
| 13 |
# |
| 14 |
|
| 15 |
--connection node_1 |
| 16 |
CREATE TABLE ten (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 17 |
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); |
| 18 |
|
| 19 |
CREATE TABLE t1 (id int not null primary key auto_increment, f1 INTEGER) ENGINE=InnoDB; |
| 20 |
|
| 21 |
--connection node_2 |
| 22 |
set session wsrep_sync_wait=0; |
| 23 |
--let $wait_condition = SELECT COUNT(*) = 10 FROM ten; |
| 24 |
--source include/wait_condition.inc |
| 25 |
|
| 26 |
--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 27 |
--connection node_1b |
| 28 |
|
| 29 |
# block applier before applying |
| 30 |
SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; |
| 31 |
|
| 32 |
--connection node_2 |
| 33 |
--send INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1 |
| 34 |
|
| 35 |
--connection node_1b |
| 36 |
# wait until applier has reached the sync point |
| 37 |
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; |
| 38 |
|
| 39 |
--connection node_1 |
| 40 |
--send TRUNCATE TABLE t1; |
| 41 |
|
| 42 |
--connection node_1b |
| 43 |
# release the applier |
| 44 |
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; |
| 45 |
SET GLOBAL debug_dbug = ""; |
| 46 |
SET DEBUG_SYNC = "RESET"; |
| 47 |
|
| 48 |
--connection node_1 |
| 49 |
--reap |
| 50 |
|
| 51 |
--connection node_2 |
| 52 |
--reap |
| 53 |
|
| 54 |
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1; |
| 55 |
--source include/wait_condition.inc |
| 56 |
SELECT COUNT(*) AS EXPECT_0 FROM t1; |
| 57 |
|
| 58 |
--connection node_1 |
| 59 |
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1; |
| 60 |
--source include/wait_condition.inc |
| 61 |
SELECT COUNT(*) AS EXPECT_0 FROM t1; |
| 62 |
|
| 63 |
--disconnect node_1b |
| 64 |
|
| 65 |
DROP TABLE t1; |
| 66 |
DROP TABLE ten; |