[MDEV-30035] Possibly unexpected ER_LOCK_WAIT_TIMEOUT upon DML and DELETE HISTORY from transaction-precise tables Created: 2022-11-18  Updated: 2023-11-28

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

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Aleksey Midenkov
Resolution: Unresolved Votes: 0
Labels: trx-versioning

Issue Links:
Relates
relates to MDEV-16226 TRX_ID-based System Versioning refact... Stalled

 Description   

--source include/have_innodb.inc
 
CREATE TABLE t1 (a INT, row_start BIGINT UNSIGNED GENERATED ALWAYS AS ROW START, row_end BIGINT UNSIGNED GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (row_start, row_end)) WITH SYSTEM VERSIONING ENGINE=InnoDB;
INSERT INTO t1 (a) VALUES (1);
CREATE TABLE t2 (b INT, row_start BIGINT UNSIGNED GENERATED ALWAYS AS ROW START, row_end BIGINT UNSIGNED GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (row_start, row_end)) WITH SYSTEM VERSIONING ENGINE=InnoDB;
 
START TRANSACTION;
INSERT INTO t2 (b) VALUES (3);
 
--connect (con1,localhost,root,,test)
SET innodb_lock_wait_timeout= 1;
START TRANSACTION;
UPDATE t1 SET a = 2;
 
--connection default
DELETE HISTORY FROM t2 BEFORE SYSTEM_TIME NOW();
 
--connection con1
COMMIT;
 
# Cleanup
--disconnect con1
--connection default
ROLLBACK;
DROP TABLE t1, t2;

The COMMIT (which commits regular DML) fails with ER_LOCK_WAIT_TIMEOUT. I presume the locking is for transaction_history but the result looks odd.

10.4 20969aa4

mysqltest: At line 19: query 'COMMIT' failed: 1205: Lock wait timeout exceeded; try restarting transaction

10.3 debug fails on an assertion instead:

10.3 df4c3d96

mysqld: /src/sql/handler.cc:1718: int ha_rollback_trans(THD*, bool): Assertion `thd->transaction.stmt.ha_list == __null || trans == &thd->transaction.stmt' failed.
221118 17:53:45 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f27bb1f2662 in __GI___assert_fail (assertion=0x55a2264ac980 "thd->transaction.stmt.ha_list == __null || trans == &thd->transaction.stmt", file=0x55a2264ab360 "/src/sql/handler.cc", line=1718, function=0x55a2264ad200 "int ha_rollback_trans(THD*, bool)") at assert.c:101
#8  0x000055a224ca5eff in ha_rollback_trans (thd=0x62a0000c0208, all=true) at /src/sql/handler.cc:1718
#9  0x000055a224ca51c6 in ha_commit_trans (thd=0x62a0000c0208, all=true) at /src/sql/handler.cc:1585
#10 0x000055a22492998e in trans_commit (thd=0x62a0000c0208) at /src/sql/transaction.cc:293
#11 0x000055a22455235a in mysql_execute_command (thd=0x62a0000c0208) at /src/sql/sql_parse.cc:5577
#12 0x000055a224561676 in mysql_parse (thd=0x62a0000c0208, rawbuf=0x62b00003f228 "COMMIT", length=6, parser_state=0x7f27a4799950, is_com_multi=false, is_next_command=false) at /src/sql/sql_parse.cc:7855
#13 0x000055a224538cc4 in dispatch_command (command=COM_QUERY, thd=0x62a0000c0208, packet=0x629000140209 "COMMIT", packet_length=6, is_com_multi=false, is_next_command=false) at /src/sql/sql_parse.cc:1852
#14 0x000055a22453587c in do_command (thd=0x62a0000c0208) at /src/sql/sql_parse.cc:1398
#15 0x000055a2248f9236 in do_handle_one_connection (connect=0x608000000fa8) at /src/sql/sql_connect.cc:1403
#16 0x000055a2248f8b32 in handle_one_connection (arg=0x608000000fa8) at /src/sql/sql_connect.cc:1308
#17 0x000055a225ea588d in pfs_spawn_thread (arg=0x615000007d88) at /src/storage/perfschema/pfs.cc:1869
#18 0x00007f27bb39dea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#19 0x00007f27bb2bdaef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95


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