[MDEV-28237] Assertion `0' failed in row_upd_sec_index_entry on DELETE Created: 2022-04-04  Updated: 2022-08-02  Resolved: 2022-04-05

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

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

Issue Links:
Duplicate
duplicates MDEV-27751 InnoDB: Failing assertion: !cursor->i... Closed
duplicates MDEV-27971 SIGSEGV in trx_undo_build_roll_ptr on... Closed
Relates
relates to MDEV-24621 In bulk insert, pre-sort and build in... Closed

 Description   

Similar to, but not the same, as MDEV-28190/MDEV-26453. Different versions and testcase.

# mysqld options required for replay: --log-bin 
CREATE TABLE t0 (c0 YEAR UNIQUE) ENGINE=InnoDB;
SET unique_checks=0,foreign_key_checks=0,autocommit=0;
INSERT INTO t0 VALUES (0),(0),(0),(0),(0),(0),(0);
DELETE FROM t0;

Leads to:

10.9.0 5be92887c2caacb45af87b1131db952ce627e83a (Debug)

mysqld: /test/10.9_dbg/storage/innobase/row/row0upd.cc:2050: dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*): Assertion `0' failed.

10.9.0 5be92887c2caacb45af87b1131db952ce627e83a (Debug)

Core was generated by `/test/MD160322-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 0x15171c1b3700 (LWP 4043152))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000151738873859 in __GI_abort () at abort.c:79
#2  0x0000151738873729 in __assert_fail_base (fmt=0x151738a09588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55c04b2271e7 "0", file=0x55c04b315380 "/test/10.9_dbg/storage/innobase/row/row0upd.cc", line=2050, function=<optimized out>) at assert.c:92
#3  0x0000151738885006 in __GI___assert_fail (assertion=assertion@entry=0x55c04b2271e7 "0", file=file@entry=0x55c04b315380 "/test/10.9_dbg/storage/innobase/row/row0upd.cc", line=line@entry=2050, function=function@entry=0x55c04b316768 "dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*)") at assert.c:101
#4  0x000055c04ac36866 in row_upd_sec_index_entry (node=node@entry=0x1516c403c878, thr=thr@entry=0x1516c4082818) at /test/10.9_dbg/storage/innobase/row/row0upd.cc:2050
#5  0x000055c04ac3763e in row_upd_sec_step (thr=0x1516c4082818, node=0x1516c403c878) at /test/10.9_dbg/storage/innobase/row/row0upd.cc:2199
#6  row_upd (thr=0x1516c4082818, node=0x1516c403c878) at /test/10.9_dbg/storage/innobase/row/row0upd.cc:2936
#7  row_upd_step (thr=thr@entry=0x1516c4082818) at /test/10.9_dbg/storage/innobase/row/row0upd.cc:3051
#8  0x000055c04abde359 in row_update_for_mysql (prebuilt=0x1516c403be88) at /test/10.9_dbg/storage/innobase/row/row0mysql.cc:1700
#9  0x000055c04aa46944 in ha_innobase::delete_row (this=0x1516c403b620, record=0x1516c403b198 <incomplete sequence \375>) at /test/10.9_dbg/storage/innobase/handler/ha_innodb.cc:8673
#10 0x000055c04a6b1176 in handler::ha_delete_row (this=0x1516c403b620, buf=0x1516c403b198 <incomplete sequence \375>) at /test/10.9_dbg/sql/handler.cc:7659
#11 0x000055c04a338afd in TABLE::delete_row (this=0x1516c4025288) at /test/10.9_dbg/sql/sql_delete.cc:281
#12 0x000055c04a336a6d in mysql_delete (thd=thd@entry=0x1516c4000db8, table_list=0x1516c4013fc0, conds=<optimized out>, order_list=order_list@entry=0x1516c4005ca8, limit=18446744073709551615, options=<optimized out>, result=<optimized out>) at /test/10.9_dbg/sql/sql_delete.cc:834
#13 0x000055c04a399589 in mysql_execute_command (thd=thd@entry=0x1516c4000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.9_dbg/sql/sql_limit.h:85
#14 0x000055c04a383437 in mysql_parse (thd=thd@entry=0x1516c4000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x15171c1b2400) at /test/10.9_dbg/sql/sql_parse.cc:8027
#15 0x000055c04a3920d3 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1516c4000db8, packet=packet@entry=0x1516c400b9a9 "DELETE FROM t0", packet_length=packet_length@entry=14, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_class.h:1362
#16 0x000055c04a39551a in do_command (thd=0x1516c4000db8, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_parse.cc:1402
#17 0x000055c04a510228 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55c04d11c198, put_in_cache=put_in_cache@entry=true) at /test/10.9_dbg/sql/sql_connect.cc:1418
#18 0x000055c04a51082d in handle_one_connection (arg=arg@entry=0x55c04d11c198) at /test/10.9_dbg/sql/sql_connect.cc:1312
#19 0x000055c04a996f23 in pfs_spawn_thread (arg=0x55c04d0304c8) at /test/10.9_dbg/storage/perfschema/pfs.cc:2201
#20 0x0000151738d84609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#21 0x0000151738970163 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

10.9.0 5be92887c2caacb45af87b1131db952ce627e83a (Debug)

2022-04-04 19:50:50 0 [Note] /test/MD160322-mariadb-10.9.0-linux-x86_64-dbg/bin/mysqld: ready for connections.
Version: '10.9.0-MariaDB-debug-log'  socket: '/test/MD160322-mariadb-10.9.0-linux-x86_64-dbg/socket.sock'  port: 10908  MariaDB Server
2022-04-04 19:50:52 5 [ERROR] InnoDB: Record in index `c0` of table `test`.`t0` was not found on update: TUPLE (info_bits=0, 2 fields): {[1] (0x00),[6]      (0x000000000200)} at: COMPACT RECORD(info_bits=0, 1 fields): {[8]infimum (0x696E66696D756D00)}
mysqld: /test/10.9_dbg/storage/innobase/row/row0upd.cc:2050: dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*): Assertion `0' failed.

Bug confirmed present in:
MariaDB: 10.7.4 (dbg), 10.8.3 (dbg), 10.9.0 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.44 (dbg), 10.2.44 (opt), 10.3.35 (dbg), 10.3.35 (opt), 10.4.25 (dbg), 10.4.25 (opt), 10.5.16 (dbg), 10.5.16 (opt), 10.6.8 (dbg), 10.6.8 (opt), 10.7.4 (opt), 10.8.3 (opt), 10.9.0 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.37 (dbg), 5.7.37 (opt), 8.0.28 (dbg), 8.0.28 (opt)



 Comments   
Comment by Roel Van de Paar [ 2022-04-04 ]

Secondary testcase, without binary logging

SET unique_checks=0,foreign_key_checks=0,autocommit=0;
CREATE TABLE t (a INT KEY,b INT UNIQUE);
INSERT INTO t SELECT SEQ,1 FROM seq_1_to_16;
DELETE FROM t ORDER BY a DESC;

Leads to:

10.9.0 5be92887c2caacb45af87b1131db952ce627e83a (Debug)

mysqld: /test/10.9_dbg/storage/innobase/row/row0upd.cc:2050: dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*): Assertion `0' failed.

10.9.0 5be92887c2caacb45af87b1131db952ce627e83a (Debug)

Core was generated by `/test/MD160322-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 0x1552cc0cb700 (LWP 453076))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00001552ecb59859 in __GI_abort () at abort.c:79
#2  0x00001552ecb59729 in __assert_fail_base (fmt=0x1552eccef588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x560711d611e7 "0", file=0x560711e4f380 "/test/10.9_dbg/storage/innobase/row/row0upd.cc", line=2050, function=<optimized out>) at assert.c:92
#3  0x00001552ecb6b006 in __GI___assert_fail (assertion=assertion@entry=0x560711d611e7 "0", file=file@entry=0x560711e4f380 "/test/10.9_dbg/storage/innobase/row/row0upd.cc", line=line@entry=2050, function=function@entry=0x560711e50768 "dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*)") at assert.c:101
#4  0x0000560711770866 in row_upd_sec_index_entry (node=node@entry=0x15528802af18, thr=thr@entry=0x15528802b210) at /test/10.9_dbg/storage/innobase/row/row0upd.cc:2050
#5  0x000056071177163e in row_upd_sec_step (thr=0x15528802b210, node=0x15528802af18) at /test/10.9_dbg/storage/innobase/row/row0upd.cc:2199
#6  row_upd (thr=0x15528802b210, node=0x15528802af18) at /test/10.9_dbg/storage/innobase/row/row0upd.cc:2936
#7  row_upd_step (thr=thr@entry=0x15528802b210) at /test/10.9_dbg/storage/innobase/row/row0upd.cc:3051
#8  0x0000560711718359 in row_update_for_mysql (prebuilt=0x15528802a4d8) at /test/10.9_dbg/storage/innobase/row/row0mysql.cc:1700
#9  0x0000560711580944 in ha_innobase::delete_row (this=0x1552880297e0, record=0x155288027dc8 "\375\020") at /test/10.9_dbg/storage/innobase/handler/ha_innodb.cc:8673
#10 0x00005607111eb176 in handler::ha_delete_row (this=0x1552880297e0, buf=0x155288027dc8 "\375\020") at /test/10.9_dbg/sql/handler.cc:7659
#11 0x0000560710e72afd in TABLE::delete_row (this=0x155288021688) at /test/10.9_dbg/sql/sql_delete.cc:281
#12 0x0000560710e70a6d in mysql_delete (thd=thd@entry=0x155288000db8, table_list=0x155288013ec0, conds=<optimized out>, order_list=order_list@entry=0x155288005ca8, limit=18446744073709551615, options=<optimized out>, result=<optimized out>) at /test/10.9_dbg/sql/sql_delete.cc:834
#13 0x0000560710ed3589 in mysql_execute_command (thd=thd@entry=0x155288000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.9_dbg/sql/sql_limit.h:85
#14 0x0000560710ebd437 in mysql_parse (thd=thd@entry=0x155288000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1552cc0ca400) at /test/10.9_dbg/sql/sql_parse.cc:8027
#15 0x0000560710ecc0d3 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x155288000db8, packet=packet@entry=0x15528800b889 "DELETE FROM t ORDER BY a DESC", packet_length=packet_length@entry=29, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_class.h:1362
#16 0x0000560710ecf51a in do_command (thd=0x155288000db8, blocking=blocking@entry=true) at /test/10.9_dbg/sql/sql_parse.cc:1402
#17 0x000056071104a228 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5607150db978, put_in_cache=put_in_cache@entry=true) at /test/10.9_dbg/sql/sql_connect.cc:1418
#18 0x000056071104a82d in handle_one_connection (arg=arg@entry=0x5607150db978) at /test/10.9_dbg/sql/sql_connect.cc:1312
#19 0x00005607114d0f23 in pfs_spawn_thread (arg=0x56071501e3f8) at /test/10.9_dbg/storage/perfschema/pfs.cc:2201
#20 0x00001552ed06a609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#21 0x00001552ecc56163 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.7.4 (dbg), 10.8.3 (dbg), 10.9.0 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.44 (dbg), 10.2.44 (opt), 10.3.35 (dbg), 10.3.35 (opt), 10.4.25 (dbg), 10.4.25 (opt), 10.5.16 (dbg), 10.5.16 (opt), 10.6.8 (dbg), 10.6.8 (opt), 10.7.4 (opt), 10.8.3 (opt), 10.9.0 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.37 (dbg), 5.7.37 (opt), 8.0.28 (dbg), 8.0.28 (opt)

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