[MDEV-24960] Assertion `m.first->second.valid(trx->undo_no)' failed in trx_undo_report_row_operation Created: 2021-02-24  Updated: 2021-02-24  Resolved: 2021-02-24

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Temporary, Storage Engine - InnoDB
Affects Version/s: 10.6
Fix Version/s: 10.6.0

Type: Bug Priority: Blocker
Reporter: Roel Van de Paar Assignee: Marko Mäkelä
Resolution: Duplicate Votes: 0
Labels: not-10.2, not-10.3, not-10.4, not-10.5, regression

Issue Links:
Duplicate
duplicates MDEV-24951 Assertion `m.first->second.valid(trx-... Closed

 Description   

CREATE TEMPORARY TABLE t (c INT);
CREATE TEMPORARY TABLE t2 (c INT);
SET SESSION tx_read_only=ON;
SET autocommit=0;
INSERT INTO t2 VALUES(1);
INSERT INTO t VALUES(1);
CREATE TABLE t3 (c INT);
DELETE FROM t;

Leads to:

10.6.0 bfb4761ca04704d68dba51f76d7c9967f880a6ee (Debug)

mysqld: /test/10.6_dbg/storage/innobase/trx/trx0rec.cc:1999: dberr_t trx_undo_report_row_operation(que_thr_t*, dict_index_t*, const dtuple_t*, const upd_t*, ulint, const rec_t*, const rec_offs*, roll_ptr_t*): Assertion `m.first->second.valid(trx->undo_no)' failed.

10.6.0 bfb4761ca04704d68dba51f76d7c9967f880a6ee (Debug)

Core was generated by `/test/MD110221-mariadb-10.6.0-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
[Current thread is 1 (Thread 0x1458f9616700 (LWP 4004360))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
#1  0x000055df634d255c in my_write_core (sig=sig@entry=6) at /test/10.6_dbg/mysys/stacktrace.c:424
#2  0x000055df62c6a4de in handle_fatal_signal (sig=6) at /test/10.6_dbg/sql/signal_handler.cc:330
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#5  0x00001459104c7859 in __GI_abort () at abort.c:79
#6  0x00001459104c7729 in __assert_fail_base (fmt=0x14591065d588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55df638e2640 "m.first->second.valid(trx->undo_no)", file=0x55df638e1a30 "/test/10.6_dbg/storage/innobase/trx/trx0rec.cc", line=1999, function=<optimized out>) at assert.c:92
#7  0x00001459104d8f36 in __GI___assert_fail (assertion=assertion@entry=0x55df638e2640 "m.first->second.valid(trx->undo_no)", file=file@entry=0x55df638e1a30 "/test/10.6_dbg/storage/innobase/trx/trx0rec.cc", line=line@entry=1999, function=function@entry=0x55df638e25a8 "dberr_t trx_undo_report_row_operation(que_thr_t*, dict_index_t*, const dtuple_t*, const upd_t*, ulint, const rec_t*, const rec_offs*, roll_ptr_t*)") at assert.c:101
#8  0x000055df632852b4 in trx_undo_report_row_operation (thr=thr@entry=0x1458c0021c68, index=index@entry=0x1458c001f458, clust_entry=clust_entry@entry=0x1458c002aae8, update=update@entry=0x0, cmpl_info=cmpl_info@entry=0, rec=rec@entry=0x1458ec67c07e "", offsets=0x1458f9613500, roll_ptr=0x1458f9613118) at /test/10.6_dbg/storage/innobase/include/trx0trx.h:525
#9  0x000055df632ec9d0 in btr_cur_del_mark_set_clust_rec (block=0x1458ec010a00, rec=rec@entry=0x1458ec67c07e "", index=index@entry=0x1458c001f458, offsets=offsets@entry=0x1458f9613500, thr=thr@entry=0x1458c0021c68, entry=entry@entry=0x1458c002aae8, mtr=0x1458f9613b40) at /test/10.6_dbg/storage/innobase/btr/btr0cur.cc:5362
#10 0x000055df63249827 in row_upd_del_mark_clust_rec (mtr=0x1458f9613b40, foreign=false, referenced=0, thr=0x1458c0021c68, offsets=0x1458f9613500, index=0x1458c001f458, node=0x1458c00219a0) at /test/10.6_dbg/storage/innobase/include/btr0cur.ic:61
#11 row_upd_clust_step (node=node@entry=0x1458c00219a0, thr=thr@entry=0x1458c0021c68) at /test/10.6_dbg/storage/innobase/row/row0upd.cc:2860
#12 0x000055df6324c84b in row_upd (thr=0x1458c0021c68, node=0x1458c00219a0) at /test/10.6_dbg/storage/innobase/row/row0upd.cc:2992
#13 row_upd_step (thr=thr@entry=0x1458c0021c68) at /test/10.6_dbg/storage/innobase/row/row0upd.cc:3136
#14 0x000055df631ed5c5 in row_update_for_mysql (prebuilt=0x1458c0020fa8) at /test/10.6_dbg/storage/innobase/row/row0mysql.cc:1805
#15 0x000055df63066f5e in ha_innobase::delete_row (this=0x1458c0020750, record=0x1458c00202e8 "\375\001") at /test/10.6_dbg/storage/innobase/handler/ha_innodb.cc:8266
#16 0x000055df62c7f32a in handler::ha_delete_row (this=0x1458c0020750, buf=0x1458c00202e8 "\375\001") at /test/10.6_dbg/sql/handler.cc:7269
#17 0x000055df62e65a17 in TABLE::delete_row (this=0x1458c001fe58) at /test/10.6_dbg/sql/sql_delete.cc:280
#18 0x000055df62e63bbc in mysql_delete (thd=thd@entry=0x1458c0000db8, table_list=0x1458c0012780, conds=<optimized out>, order_list=order_list@entry=0x1458c0005a28, limit=18446744073709551615, options=<optimized out>, result=0x0) at /test/10.6_dbg/sql/sql_delete.cc:815
#19 0x000055df629a82f8 in mysql_execute_command (thd=thd@entry=0x1458c0000db8) at /test/10.6_dbg/sql/sql_limit.h:67
#20 0x000055df6299221a in mysql_parse (thd=thd@entry=0x1458c0000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1458f96153d0) at /test/10.6_dbg/sql/sql_parse.cc:7906
#21 0x000055df629a030b in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1458c0000db8, packet=packet@entry=0x1458c001aac9 "DELETE FROM t", packet_length=packet_length@entry=13) at /test/10.6_dbg/sql/sql_class.h:1295
#22 0x000055df629a363d in do_command (thd=0x1458c0000db8) at /test/10.6_dbg/sql/sql_parse.cc:1365
#23 0x000055df62aff1ab in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55df65357df8, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
#24 0x000055df62aff8af in handle_one_connection (arg=arg@entry=0x55df65357df8) at /test/10.6_dbg/sql/sql_connect.cc:1312
#25 0x000055df62fb327d in pfs_spawn_thread (arg=0x55df6528bef8) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
#26 0x00001459109d5609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#27 0x00001459105c4293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.6.0 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.37 (dbg), 10.2.37 (opt), 10.3.28 (dbg), 10.3.28 (opt), 10.4.18 (dbg), 10.4.18 (opt), 10.5.9 (dbg), 10.5.9 (opt), 10.6.0 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.33 (dbg), 5.7.33 (opt), 8.0.23 (dbg), 8.0.23 (opt)



 Comments   
Comment by Thirunarayanan Balathandayuthapani [ 2021-02-24 ]

For Read Only transaction, InnoDB doesn't clear mod_tables during commit. It should be fixed by MDEV-24951 patch.
Create table does implicit commit, and it fails to clear mod_tables. Concurrent delete fails while logging undo row
operation.

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