|
| 1 | +--source include/galera_cluster.inc |
| 2 | +--source include/have_innodb.inc |
| 3 | +--source include/have_debug_sync.inc |
| 4 | +--source include/galera_have_debug_sync.inc |
| 5 | + |
| 6 | +# |
| 7 | +# Testing CREATE TABLE statement having foreign key constraint, |
| 8 | +# while having concurrent DML for the referenced parent table. |
| 9 | +# |
| 10 | +# The replication of CREATE TABLE should have all referenced table names |
| 11 | +# appended in the key set, and DML on the parent table should be considered as |
| 12 | +# conflicting. |
| 13 | +# |
| 14 | +# There are related test scenarios in test mysql-wsrep#332, where a regular table |
| 15 | +# is altered by adding new foreign key reference. |
| 16 | +# |
| 17 | +# We use concurrency facility of test MW-369 to setup the conflict between DDL and DML |
| 18 | +# |
| 19 | + |
| 20 | +# Open connection node_1a here, MW-369.inc will use it later |
| 21 | +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 22 | + |
| 23 | +# create FK parent table |
| 24 | +--connection node_1 |
| 25 | +CREATE TABLE p (id INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; |
| 26 | + |
| 27 | +# setup conflicting queries |
| 28 | +--let $mw_369_parent_query = INSERT INTO p VALUES(1,0) |
| 29 | +--let $mw_369_child_query = CREATE TABLE c(id INT NOT NULL PRIMARY KEY, p_id INT, FOREIGN KEY (p_id) REFERENCES p(id) ON DELETE CASCADE) ENGINE=InnoDB |
| 30 | + |
| 31 | +# execute above queries through separate nodes |
| 32 | +--source MW-369.inc |
| 33 | + |
| 34 | +# Expect certification failure |
| 35 | +--connection node_1 |
| 36 | +--error ER_LOCK_DEADLOCK |
| 37 | +--reap |
| 38 | + |
| 39 | +--connection node_2 |
| 40 | +SELECT * FROM p; |
| 41 | +SELECT * FROM c; |
| 42 | + |
| 43 | +DROP TABLE c; |
| 44 | +DROP TABLE p; |
0 commit comments