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

MDEV-28242 Assertion `!check_foreigns' failed in trx_t::check_bulk_buffer

If transaction does bulk insert and disables the foreign_key_check
then InnoDB fails with the assert failure. InnoDB has strict
assertion that check_foreigns and unique_secondary_check
should be enabled if the transaction does bulk insert
in innodb_prepare_commit_versioned().
This commit is contained in:
Thirunarayanan Balathandayuthapani
2022-07-13 21:06:59 +05:30
parent 48f3cf7570
commit 3808ffbcb5
3 changed files with 27 additions and 2 deletions

View File

@@ -281,3 +281,18 @@ c
SELECT * FROM t2; SELECT * FROM t2;
c c
DROP TABLE t2, t1; DROP TABLE t2, t1;
#
# MDEV-28242 Assertion `!check_foreigns' failed in
# trx_t::check_bulk_buffer
#
CREATE TABLE t1 (c INT)ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 VALUES(1), (1);
SET SESSION foreign_key_checks=TRUE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
CREATE TABLE t2(d INT)ENGINE=InnoDB;
DROP TABLE t2, t1;

View File

@@ -292,3 +292,15 @@ INSERT INTO t1 VALUES (0);
SELECT * FROM t1; SELECT * FROM t1;
SELECT * FROM t2; SELECT * FROM t2;
DROP TABLE t2, t1; DROP TABLE t2, t1;
--echo #
--echo # MDEV-28242 Assertion `!check_foreigns' failed in
--echo # trx_t::check_bulk_buffer
--echo #
CREATE TABLE t1 (c INT)ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 VALUES(1), (1);
SET SESSION foreign_key_checks=TRUE;
SHOW CREATE TABLE t1;
CREATE TABLE t2(d INT)ENGINE=InnoDB;
DROP TABLE t2, t1;

View File

@@ -3801,8 +3801,6 @@ static ulonglong innodb_prepare_commit_versioned(THD* thd, ulonglong *trx_id)
if (t.second.is_bulk_insert()) if (t.second.is_bulk_insert())
{ {
ut_ad(trx->bulk_insert); ut_ad(trx->bulk_insert);
ut_ad(!trx->check_unique_secondary);
ut_ad(!trx->check_foreigns);
if (t.second.write_bulk(t.first, trx)) if (t.second.write_bulk(t.first, trx))
return ULONGLONG_MAX; return ULONGLONG_MAX;
} }