1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-26052 Assertion prebuilt->trx_id < table->def_trx_id failed

ha_innobase::truncate(): If the operation fails, preserve
also dict_table_t::def_trx_id.

This fixes a regression that had been introduced in
commit 1bd681c8b3 (MDEV-25506).
This commit is contained in:
Marko Mäkelä
2021-07-01 19:06:53 +03:00
parent ed6b230744
commit 315380a4d1
3 changed files with 39 additions and 0 deletions

View File

@@ -68,3 +68,21 @@ TRUNCATE TABLE t1;
ALTER TABLE t1 ADD c INT;
UNLOCK TABLES;
DROP TABLE t1;
#
# MDEV-26052 Assertion prebuilt->trx_id < table->def_trx_id failed
#
call mtr.add_suppression("InnoDB: In ALTER TABLE `test`\\.`t1` has or is");
CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk), KEY (a)) ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=0;
ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (a), ALGORITHM=COPY;
INSERT INTO t1 VALUES (1,1);
LOCK TABLES t1 WRITE;
TRUNCATE t1;
ERROR HY000: Cannot add foreign key constraint for `t1`
INSERT INTO t1 VALUES (2,2);
SELECT * FROM t1;
pk a
1 1
2 2
DROP TABLE t1;
# End of 10.6 tests