[MDEV-27040] Was: Assertion `thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt' failed in ha_rollback_trans Created: 2021-11-13  Updated: 2023-10-06

Status: Open
Project: MariaDB Server
Component/s: Server, Versioned Tables
Affects Version/s: 10.6, 10.7, 10.8, 10.9
Fix Version/s: 10.6

Type: Bug Priority: Minor
Reporter: Roel Van de Paar Assignee: Aleksey Midenkov
Resolution: Unresolved Votes: 0
Labels: not-10.2, not-10.3, not-10.4, not-10.5, regression, trx-versioning

Issue Links:
Relates
relates to MDEV-16226 TRX_ID-based System Versioning refact... Stalled
relates to MDEV-21650 Non-empty statement transaction on gl... Closed
relates to MDEV-27239 Spider: Assertion `thd->transaction->... Closed

 Description   

Very similar to, and likely related to, MDEV-21650, however the affected versions are the opposite. Also only a single connection is needed.

CREATE TABLE t0 (t0 TEXT,FULLTEXT (t0)) ENGINE=InnoDB;
INSERT INTO t0 VALUES (0),(0),(0),(0),(0);
SET autocommit=0;
ALTER TABLE t0 ADD COLUMN trx_start BIGINT(0) UNSIGNED AS ROW START INVISIBLE,ADD COLUMN trx_end BIGINT(0) UNSIGNED AS ROW END INVISIBLE,ADD period FOR SYSTEM_TIME(trx_start,trx_end),ADD SYSTEM VERSIONING;

Leads to:

10.8.0 bc57ff7cf79504a198d4752b4748340a4afd886c (Debug)

mysqld: /test/10.8_dbg/sql/handler.cc:2113: int ha_rollback_trans(THD*, bool): Assertion `thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt' failed.

10.8.0 bc57ff7cf79504a198d4752b4748340a4afd886c (Debug)

Core was generated by `/test/MD121121-mariadb-10.8.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 0x1493340cb700 (LWP 1857158))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000149337caa859 in __GI_abort () at abort.c:79
#2  0x0000149337caa729 in __assert_fail_base (fmt=0x149337e40588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x560587237600 "thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt", file=0x560587235dd3 "/test/10.8_dbg/sql/handler.cc", line=2113, function=<optimized out>) at assert.c:92
#3  0x0000149337cbbf36 in __GI___assert_fail (assertion=assertion@entry=0x560587237600 "thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt", file=file@entry=0x560587235dd3 "/test/10.8_dbg/sql/handler.cc", line=line@entry=2113, function=function@entry=0x5605872375d8 "int ha_rollback_trans(THD*, bool)") at assert.c:101
#4  0x00005605866d4a26 in ha_rollback_trans (thd=thd@entry=0x1492e4000db8, all=all@entry=true) at /test/10.8_dbg/sql/handler.cc:2113
#5  0x00005605866e8ae3 in ha_commit_trans (thd=thd@entry=0x1492e4000db8, all=all@entry=true) at /test/10.8_dbg/sql/handler.cc:1931
#6  0x00005605865626d8 in trans_commit_implicit (thd=thd@entry=0x1492e4000db8) at /test/10.8_dbg/sql/transaction.cc:329
#7  0x00005605863d9edc in mysql_execute_command (thd=thd@entry=0x1492e4000db8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.8_dbg/sql/sql_parse.cc:6089
#8  0x00005605863bfcad in mysql_parse (thd=thd@entry=0x1492e4000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1493340ca400) at /test/10.8_dbg/sql/sql_parse.cc:8028
#9  0x00005605863ce949 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1492e4000db8, packet=packet@entry=0x1492e400b879 "ALTER TABLE t0 ADD COLUMN trx_start BIGINT(0) UNSIGNED AS ROW START INVISIBLE,ADD COLUMN trx_end BIGINT(0) UNSIGNED AS ROW END INVISIBLE,ADD period FOR SYSTEM_TIME(trx_start,trx_end),ADD SYSTEM VERSIO"..., packet_length=packet_length@entry=204, blocking=blocking@entry=true) at /test/10.8_dbg/sql/sql_class.h:1360
#10 0x00005605863d1d83 in do_command (thd=0x1492e4000db8, blocking=blocking@entry=true) at /test/10.8_dbg/sql/sql_parse.cc:1402
#11 0x000056058654be2a in do_handle_one_connection (connect=<optimized out>, connect@entry=0x560588d4f3a8, put_in_cache=put_in_cache@entry=true) at /test/10.8_dbg/sql/sql_connect.cc:1418
#12 0x000056058654c42f in handle_one_connection (arg=arg@entry=0x560588d4f3a8) at /test/10.8_dbg/sql/sql_connect.cc:1312
#13 0x00005605869cc4ce in pfs_spawn_thread (arg=0x560588c62e48) at /test/10.8_dbg/storage/perfschema/pfs.cc:2201
#14 0x00001493381b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#15 0x0000149337da7293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.6.6 (dbg), 10.7.2 (dbg), 10.8.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 (opt), 10.7.2 (opt), 10.8.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)



 Comments   
Comment by Roel Van de Paar [ 2022-03-08 ]

The result of the testcase has changed, but it does not look for the better.

10.7.4 3d88f9f34c1223c59272d5086dcd2b4b2cfc167b (Debug)

ERROR 1062 (23000): Duplicate entry '31' for key 'PRIMARY'

There is no entry 31. Adding corruption tag and increasing prio.

Comment by Aleksey Midenkov [ 2022-03-29 ]

trx-versioning requires redesign which depreciates most of the bugs. My priority to fix bugs in trx-versioning is lower than for other subsystems.

Comment by Aleksey Midenkov [ 2022-03-29 ]

There is no entry 31. Adding corruption tag and increasing prio.

Roel Did you check the table consistency after ALTER TABLE? When ALTER TABLE fails with some unexpected error doesn't mean data was corrupted.

I guess 31 is TRX_ID and the error is about TRANSACTION_REGISTRY. So high chances are there is no data corruption. It's just failure of inserting some wrong row into TRANSACTION_REGISTRY.

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