[MDEV-27858] Assertion `page_dir_get_n_heap(new_page) == 2U' failed in PageBulk::init Created: 2022-02-16  Updated: 2023-04-07  Resolved: 2022-03-23

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.7, 10.8, 10.9
Fix Version/s: 10.7.4, 10.8.3

Type: Bug Priority: Critical
Reporter: Roel Van de Paar Assignee: Thirunarayanan Balathandayuthapani
Resolution: Fixed Votes: 0
Labels: not-10.2, not-10.3, not-10.4, not-10.5, not-10.6, regression

Issue Links:
Problem/Incident
is caused by MDEV-24621 In bulk insert, pre-sort and build in... Closed
Relates
relates to MDEV-26655 Assertion `page_dir_get_n_heap(new_pa... Closed
relates to MDEV-27890 SIGSEGV in innobase_get_mysql_key_num... Closed
relates to MDEV-31025 Redundant table alter fails when fixe... Closed

 Description   

Somewhat similar stack to MDEV-26655 but different versions affected and different stack

SET unique_checks=0, foreign_key_checks=0, autocommit=0;
CREATE TABLE t (c INT) ENGINE=InnoDB;
CREATE TABLE t2 (c INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1);
LOCK TABLES t WRITE,t2 WRITE;
INSERT INTO t VALUES (1);
INSERT INTO t2 VALUES (1);

Leads to:

10.9.0 b5852ffbeebc3000982988383daeefb0549e058a (Debug)

mysqld: /test/10.9_dbg/storage/innobase/btr/btr0bulk.cc:110: dberr_t PageBulk::init(): Assertion `page_dir_get_n_heap(new_page) == 2U' failed.

10.9.0 b5852ffbeebc3000982988383daeefb0549e058a (Debug)

Core was generated by `/test/MD140222-mariadb-10.9.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
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 0x154308159700 (LWP 3273765))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000154327e19859 in __GI_abort () at abort.c:79
#2  0x0000154327e19729 in __assert_fail_base (fmt=0x154327faf588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55a591c69040 "page_dir_get_n_heap(new_page) == 2U", file=0x55a591c69478 "/test/10.9_dbg/storage/innobase/btr/btr0bulk.cc", line=110, function=<optimized out>) at assert.c:92
#3  0x0000154327e2af36 in __GI___assert_fail (assertion=assertion@entry=0x55a591c69040 "page_dir_get_n_heap(new_page) == 2U", file=file@entry=0x55a591c69478 "/test/10.9_dbg/storage/innobase/btr/btr0bulk.cc", line=line@entry=110, function=function@entry=0x55a591c68dde "dberr_t PageBulk::init()") at assert.c:101
#4  0x000055a5915fd3c6 in PageBulk::init (this=this@entry=0x154308156c40) at /test/10.9_dbg/storage/innobase/include/page0page.inl:364
#5  0x000055a5916003cd in BtrBulk::finish (this=this@entry=0x154308157260, err=<optimized out>) at /test/10.9_dbg/storage/innobase/btr/btr0bulk.cc:1215
#6  0x000055a59150d60a in row_merge_bulk_t::write_to_index (this=this@entry=0x1542c007a7a0, index_no=index_no@entry=0, trx=trx@entry=0x1543172491e0) at /test/10.9_dbg/storage/innobase/row/row0merge.cc:5266
#7  0x000055a59150d714 in row_merge_bulk_t::write_to_table (this=0x1542c007a7a0, table=<optimized out>, trx=trx@entry=0x1543172491e0) at /test/10.9_dbg/storage/innobase/row/row0merge.cc:5279
#8  0x000055a5915c5351 in trx_mod_table_time_t::write_bulk (trx=0x1543172491e0, table=<optimized out>, this=0x1542c007b840) at /test/10.9_dbg/storage/innobase/include/trx0trx.h:519
#9  trx_t::bulk_insert_apply (this=<optimized out>) at /test/10.9_dbg/storage/innobase/include/trx0trx.h:1133
#10 trx_mark_sql_stat_end (trx=trx@entry=0x1543172491e0) at /test/10.9_dbg/storage/innobase/trx/trx0trx.cc:1630
#11 0x000055a591381fd2 in innobase_commit (hton=<optimized out>, thd=0x1542c0000db8, commit_trx=<optimized out>) at /test/10.9_dbg/storage/innobase/handler/ha_innodb.cc:4551
#12 0x000055a590fe32fb in commit_one_phase_2 (thd=thd@entry=0x1542c0000db8, all=all@entry=false, trans=trans@entry=0x1542c0004758, is_real_trans=is_real_trans@entry=false) at /test/10.9_dbg/sql/handler.cc:2051
#13 0x000055a590fe3613 in ha_commit_one_phase (thd=thd@entry=0x1542c0000db8, all=all@entry=false) at /test/10.9_dbg/sql/handler.cc:2004
#14 0x000055a590ff7a30 in ha_commit_trans (thd=thd@entry=0x1542c0000db8, all=all@entry=false) at /test/10.9_dbg/sql/handler.cc:1798
#15 0x000055a590e68bc6 in trans_commit_stmt (thd=thd@entry=0x1542c0000db8) at /test/10.9_dbg/sql/transaction.cc:472
#16 0x000055a590cdf190 in mysql_execute_command (thd=thd@entry=0x1542c0000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.9_dbg/sql/sql_parse.cc:6048
#17 0x000055a590cc5315 in mysql_parse (thd=thd@entry=0x1542c0000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x154308158400) at /test/10.9_dbg/sql/sql_parse.cc:8027
#18 0x000055a590cd3fb1 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1542c0000db8, packet=packet@entry=0x1542c000b889 "INSERT INTO t2 VALUES (1)", packet_length=packet_length@entry=25, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_class.h:1362
#19 0x000055a590cd73f8 in do_command (thd=0x1542c0000db8, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_parse.cc:1402
#20 0x000055a590e51fc4 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55a5948c7f38, put_in_cache=put_in_cache@entry=true) at /test/10.9_dbg/sql/sql_connect.cc:1418
#21 0x000055a590e525c9 in handle_one_connection (arg=arg@entry=0x55a5948c7f38) at /test/10.9_dbg/sql/sql_connect.cc:1312
#22 0x000055a5912d8d67 in pfs_spawn_thread (arg=0x55a59480a548) at /test/10.9_dbg/storage/perfschema/pfs.cc:2201
#23 0x0000154328328609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#24 0x0000154327f16293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.7.2 (dbg), 10.8.1 (dbg), 10.9.0 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.42 (dbg), 10.2.42 (opt), 10.3.33 (dbg), 10.3.33 (opt), 10.4.23 (dbg), 10.4.23 (opt), 10.5.14 (dbg), 10.5.14 (opt), 10.6.6 (dbg), 10.6.6 (opt), 10.7.2 (opt), 10.8.1 (opt), 10.9.0 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.36 (dbg), 5.7.36 (opt), 8.0.27 (dbg), 8.0.27 (opt)


Generated at Thu Feb 08 09:56:07 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.