[MDEV-33243] Assertion `!check_foreigns' failed in dberr_t trx_t::bulk_insert_apply_low() Created: 2024-01-15  Updated: 2024-01-15

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.11, 11.0, 11.1, 11.2, 11.3, 11.4
Fix Version/s: 10.11, 11.0, 11.1, 11.2, 11.3, 11.4

Type: Bug Priority: Major
Reporter: Ramesh Sivaraman Assignee: Thirunarayanan Balathandayuthapani
Resolution: Unresolved Votes: 0
Labels: debug, foreign-keys, regression

Issue Links:
Relates
relates to MDEV-24621 In bulk insert, pre-sort and build in... Closed

 Description   

SET SESSION unique_checks=FALSE;
SET SESSION autocommit=0;
CREATE OR REPLACE TABLE t1 (a INT);
LOCK TABLES t1 WRITE;
CREATE OR REPLACE TABLE t1 (a INT);
SET SESSION foreign_key_checks=OFF;
INSERT INTO t1 VALUES (1);
SET SESSION foreign_key_checks=ON;
SELECT * FROM t1;

Leads to:

11.4.0 c0c1c80346b926ea1358aa512374d72d513299b0 (Debug)

mariadbd: /test/11.4_dbg/storage/innobase/row/row0merge.cc:5359: dberr_t trx_t::bulk_insert_apply_low(): Assertion `!check_foreigns' failed.

11.4.0 c0c1c80346b926ea1358aa512374d72d513299b0 (Debug)

Core was generated by `/test/MD100124-mariadb-11.4.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --cor'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[Current thread is 1 (Thread 0x152b90109700 (LWP 1561091))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000152ba8191859 in __GI_abort () at abort.c:79
#2  0x0000152ba8191729 in __assert_fail_base (fmt=0x152ba8327588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x559713f230b1 "!check_foreigns", file=0x559713f25478 "/test/11.4_dbg/storage/innobase/row/row0merge.cc", line=5359, function=<optimized out>) at assert.c:92
#3  0x0000152ba81a2fd6 in __GI___assert_fail (assertion=assertion@entry=0x559713f230b1 "!check_foreigns", file=file@entry=0x559713f25478 "/test/11.4_dbg/storage/innobase/row/row0merge.cc", line=line@entry=5359, function=function@entry=0x559713f26810 "dberr_t trx_t::bulk_insert_apply_low()") at assert.c:101
#4  0x00005597137fdf9e in trx_t::bulk_insert_apply_low (this=this@entry=0x152ba5880b80) at /test/11.4_dbg/storage/innobase/row/row0merge.cc:5359
#5  0x000055971369d264 in trx_t::bulk_insert_apply (this=0x152ba5880b80) at /test/11.4_dbg/storage/innobase/include/trx0trx.h:1161
#6  ha_innobase::start_stmt (this=0x152b58079ec0, thd=0x152b58000d48, lock_type=TL_READ) at /test/11.4_dbg/storage/innobase/handler/ha_innodb.cc:15759
#7  0x0000559712f66751 in check_lock_and_start_stmt (thd=thd@entry=0x152b58000d48, prelocking_ctx=<optimized out>, table_list=table_list@entry=0x152b58013ba0) at /test/11.4_dbg/sql/sql_base.cc:5405
#8  0x0000559712f68f35 in lock_tables (thd=thd@entry=0x152b58000d48, tables=0x152b58013ba0, count=<optimized out>, flags=flags@entry=0) at /test/11.4_dbg/sql/sql_base.cc:5981
#9  0x0000559712f6ab6e in open_and_lock_tables (thd=thd@entry=0x152b58000d48, options=<optimized out>, tables=<optimized out>, tables@entry=0x152b58013ba0, derived=derived@entry=true, flags=flags@entry=0, prelocking_strategy=prelocking_strategy@entry=0x152b90107780) at /test/11.4_dbg/sql/sql_base.cc:5637
#10 0x0000559712fe6a6b in open_and_lock_tables (flags=0, derived=true, tables=0x152b58013ba0, thd=0x152b58000d48) at /test/11.4_dbg/sql/sql_base.h:528
#11 execute_sqlcom_select (thd=thd@entry=0x152b58000d48, all_tables=0x152b58013ba0) at /test/11.4_dbg/sql/sql_parse.cc:5998
#12 0x0000559712ff39cb in mysql_execute_command (thd=thd@entry=0x152b58000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.4_dbg/sql/sql_parse.cc:3926
#13 0x0000559712fe0e4e in mysql_parse (thd=thd@entry=0x152b58000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x152b901082b0) at /test/11.4_dbg/sql/sql_parse.cc:7798
#14 0x0000559712feed2a in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x152b58000d48, packet=packet@entry=0x152b5800b1b9 "SELECT * FROM t1", packet_length=packet_length@entry=16, blocking=blocking@entry=true) at /test/11.4_dbg/sql/sql_class.h:1552
#15 0x0000559712ff1456 in do_command (thd=0x152b58000d48, blocking=blocking@entry=true) at /test/11.4_dbg/sql/sql_parse.cc:1406
#16 0x000055971316c0ff in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5597161aa518, put_in_cache=put_in_cache@entry=true) at /test/11.4_dbg/sql/sql_connect.cc:1417
#17 0x000055971316c6b4 in handle_one_connection (arg=arg@entry=0x5597161aa518) at /test/11.4_dbg/sql/sql_connect.cc:1319
#18 0x00005597135dabc8 in pfs_spawn_thread (arg=0x55971617ec48) at /test/11.4_dbg/storage/perfschema/pfs.cc:2201
#19 0x0000152ba86a2609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#20 0x0000152ba828e133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.11.7 (dbg), 11.0.5 (dbg), 11.1.4 (dbg), 11.2.3 (dbg), 11.3.2 (dbg), 11.4.0 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.4.33 (dbg), 10.4.33 (opt), 10.5.24 (dbg), 10.5.24 (opt), 10.6.17 (dbg), 10.6.17 (opt), 10.11.7 (opt), 11.0.5 (opt), 11.1.4 (opt), 11.2.3 (opt), 11.3.2 (opt), 11.4.0 (opt)


Generated at Thu Feb 08 10:37:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.