mariadb/mysql-test/suite/galera/r/MDEV-35018.result
Daniele Sciascia 841a7d391b MDEV-35018 MDL BF-BF conflict on DROP TABLE
DROP TABLE on child and UPDATE of parent table can cause an MDL BF-BF
conflict when applied concurrently.
DROP TABLE takes MDL locks on both child and its parent table, however
it only it did not add certification keys for the parent table.
This patch adds the following:
 * Append certification keys corresponding to all parent tables
   before DROP TABLE replication.
 * Fix wsrep_append_fk_parent_table() so that it works when it is
   given a table list containing temporary tables.
 * Make sure function wsrep_append_fk_parent_table() is only called
   for local transaction. That was not the case for ALTER TABLE.
 * Add a test case that verifies that UPDATE parent depends on
   preceeding DROP TABLE child.
 * Adapt galera_ddl_fk_conflict test to work with DROP TABLE as well.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
2025-01-24 17:02:44 +01:00

38 lines
997 B
Text

connection node_2;
connection node_1;
connection node_2;
SET GLOBAL wsrep_slave_threads=2;
CREATE TABLE t1 (
id INTEGER PRIMARY KEY,
f2 INTEGER);
CREATE TABLE t2 (
f1 INT PRIMARY KEY,
t1_id INT NOT NULL,
f2 INTEGER NOT NULL,
KEY key_t1_id(t1_id),
CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE);
INSERT INTO t1 VALUES (1,0);
INSERT INTO t1 VALUES (2,0);
INSERT INTO t2 VALUES (1,1,1234);
INSERT INTO t2 VALUES (2,2,1234);
connection node_2;
SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_toi";
connection node_1;
DROP TABLE t2;
connection node_2;
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached";
SET SESSION wsrep_sync_wait = 0;
1
connection node_1;
UPDATE t1 SET f2 = 1 WHERE id=2;
connection node_2;
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi";
SET SESSION wsrep_sync_wait = DEFAULT;
SELECT * FROM t1;
id f2
1 0
2 1
SET DEBUG_SYNC = 'RESET';
SET GLOBAL DEBUG_DBUG = '';
SET GLOBAL wsrep_slave_threads = DEFAULT;
DROP TABLE t1;