Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
None
-
Can result in hang or crash
-
Q4/2025 Galera Development
Description
In a Galera cluster a CREATE TRIGGER execution can have a MDL conflict with a replicated INSERT execution, if INSERT and CREATE happen on separate tables having foreign key constraint, e.g. like this:
CREATE TABLE parent ( id INT PRIMARY KEY) ENGINE=InnoDB;
|
CREATE TABLE child (id INT PRIMARY KEY, parent1_id INT,FOREIGN KEY (parent_id) REFERENCES parent(id)) ENGINE=InnoDB;
|
 |
then two sessions, connected in separate nodes;
|
node1> insert into parent1 values (1) |
node2> CREATE TRIGGER trg BEFORE UPDATE ON child FOR EACH ROW BEGIN END;
|
CREATE TRIGGER execution appears to take MDL lock on the parent table, but only in the primary node, in secondary node, the replication does not use MDL lock on parent table. Therefore the INSERT and CREATE TRIGGER have to happen in separate nodes.