codership/mysql-wsrep

8.0: Data import fails in presence of foreign key constraints

temeo opened this issue · 0 comments

temeo commented

Having tables:

CREATE TABLE parent (f1 INT PRIMARY KEY);

CREATE TABLE child (
    f1 INT PRIMARY KEY,
    parent_f1 INT,
    FOREIGN KEY (parent_f1) REFERENCES parent(f1)
);


INSERT INTO parent VALUES (1), (2);
INSERT INTO child VALUES (1, 1);

the data dump created by mysqldump cannot be loaded in the running cluster. Applying the write sets from data dump fail with

2020-11-24T10:39:36.062861Z 0 [Note] [MY-000000] [Server] WSREP: Member 1(x1c) initiates vote on 532928b6-2e41-11eb-b9ac-ea8e025d5acb:13,9f23a33c9e142ba4:  Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_f1`) REFERENCES `parent` (`f1`)), Error_code: 1452;