Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.4(EOL), 10.5, 10.6
-
None
Description
When using the KB example for creating a table pair with a foreign key constraint:
CREATE TABLE author (
|
id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
name VARCHAR(100) NOT NULL
|
) ENGINE = InnoDB;
|
|
CREATE TABLE book (
|
id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
title VARCHAR(200) NOT NULL,
|
author_id SMALLINT UNSIGNED NOT NULL,
|
CONSTRAINT `fk_book_author`
|
FOREIGN KEY (author_id) REFERENCES author (id)
|
ON DELETE CASCADE
|
ON UPDATE RESTRICT
|
) ENGINE = InnoDB;
|
|
INSERT INTO author (name) VALUES ('Abdul Alhazred');
|
INSERT INTO book (title, author_id) VALUES ('Necronomicon', LAST_INSERT_ID());
|
Then truncating the "book" table:
TRUNCATE TABLE book;
|
The table is empty as expected on the node where the TRUNCATE was executed, but not on the other nodes in the cluster.
Nothing is logged in the error log, it seems as if the TRUNCATE is just silently ignored.
The earliest version I can reproduce this on is MariaDB 10.5.9, so it seems to be a rather recent regression, on earlier versions it works as expected.
I filed this as "critical" as it can easily lead to data inconsistencies across the cluster which may only actually be detected, and lead to problems, much later.
Attachments
Issue Links
- relates to
-
MDEV-26085 TRUNCATE on table does not take foreign keys in account
- Closed