[MDEV-22619] WITHOUT OVERLAPS: Assertion `trnman_has_locked_tables(trn) > 0' fails in ha_maria::external_lock upon INSERT IGNORE Created: 2020-05-18  Updated: 2020-11-02  Resolved: 2020-10-22

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Aria, Versioned Tables
Affects Version/s: 10.5
Fix Version/s: 10.5.4

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Michael Widenius
Resolution: Done Votes: 0
Labels: None

Issue Links:
Relates

 Description   

Note: The test case is non-deterministic, run with --repeat=N. Currently it always fails for me within 1-5 attempts, but it can vary on different machines and builds.

--source include/have_log_bin.inc
 
CREATE TABLE t0 (pk INT) ENGINE=Aria;
INSERT INTO t0 VALUES (1),(2);
 
CREATE TABLE t1 (a INT) ENGINE=Aria;
CREATE TABLE t2 (id INT, s DATETIME, e DATETIME, PERIOD FOR p(s,e), PRIMARY KEY(id, p WITHOUT OVERLAPS)) ENGINE=Aria;
 
--connect (con1,localhost,root,,test)
LOCK TABLE t2 WRITE;
--send
  INSERT IGNORE INTO t2 VALUES (1,'1974-02-02','1993-11-07');
 
--connection default
SELECT * FROM t1;
 
--connection con1
--reap
 
# Cleanup
--disconnect con1
--connection default
DROP TABLE t0, t1, t2;

10.5 5d85bc08

mariadbd: /data/src/10.5/storage/maria/ha_maria.cc:2812: virtual int ha_maria::external_lock(THD*, int): Assertion `trnman_has_locked_tables(trn) > 0' failed.
200518 21:42:40 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f433235ef12 in __GI___assert_fail (assertion=0x55f051e0c0c0 "trnman_has_locked_tables(trn) > 0", file=0x55f051e0a200 "/data/src/10.5/storage/maria/ha_maria.cc", line=2812, function=0x55f051e0dca0 <ha_maria::external_lock(THD*, int)::__PRETTY_FUNCTION__> "virtual int ha_maria::external_lock(THD*, int)") at assert.c:101
#8  0x000055f05079b265 in ha_maria::external_lock (this=0x62b0000a2d90, thd=0x62b000085288, lock_type=2) at /data/src/10.5/storage/maria/ha_maria.cc:2812
#9  0x000055f0501d578b in handler::ha_external_lock (this=0x62b0000a2d90, thd=0x62b000085288, lock_type=2) at /data/src/10.5/sql/handler.cc:6511
#10 0x000055f04fcbe0a4 in handler::ha_external_unlock (this=0x62b0000a2d90, thd=0x62b000085288) at /data/src/10.5/sql/handler.h:3384
#11 0x000055f0501d64f6 in handler::ha_reset (this=0x61d0002b0328) at /data/src/10.5/sql/handler.cc:6577
#12 0x000055f04f8e5273 in mark_used_tables_as_free_for_reuse (thd=0x62b000085288, table=0x620000059108) at /data/src/10.5/sql/sql_base.cc:672
#13 0x000055f04f8e6416 in close_thread_tables (thd=0x62b000085288) at /data/src/10.5/sql/sql_base.cc:866
#14 0x000055f04fa71128 in mysql_execute_command (thd=0x62b000085288) at /data/src/10.5/sql/sql_parse.cc:5980
#15 0x000055f04fa7c9fb in mysql_parse (thd=0x62b000085288, rawbuf=0x62b0000a12a8 "INSERT IGNORE INTO t2 VALUES (1,'1974-02-02','1993-11-07')", length=58, parser_state=0x7f4328e05a60, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:7957
#16 0x000055f04fa57498 in dispatch_command (command=COM_QUERY, thd=0x62b000085288, packet=0x6290004ec289 "INSERT IGNORE INTO t2 VALUES (1,'1974-02-02','1993-11-07')", packet_length=58, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1840
#17 0x000055f04fa54488 in do_command (thd=0x62b000085288) at /data/src/10.5/sql/sql_parse.cc:1359
#18 0x000055f04fe0b5f6 in do_handle_one_connection (connect=0x611000021a48, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1411
#19 0x000055f04fe0b065 in handle_one_connection (arg=0x611000022088) at /data/src/10.5/sql/sql_connect.cc:1313
#20 0x000055f0509ebeb7 in pfs_spawn_thread (arg=0x616000649608) at /data/src/10.5/storage/perfschema/pfs.cc:2201
#21 0x00007f43342e74a4 in start_thread (arg=0x7f4328e07300) at pthread_create.c:456
#22 0x00007f433241bd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Couldn't reproduce without WITHOUT OVERLAPS.
No obvious problem on a non-debug build.



 Comments   
Comment by Elena Stepanova [ 2020-10-21 ]

The failure stopped happening on 10.5 after this commit:

commit 4102f1589c23309de968a5bf9511d3228a1b9319 (HEAD)
Author: Monty <monty@mariadb.org>
Date:   Sat May 2 13:19:53 2020 +0300
 
    Aria will now register it's transactions
    
    MDEV-22531 Remove maria::implicit_commit()
    MDEV-22607 Assertion `ha_info->ht() != binlog_hton' failed in
               MYSQL_BIN_LOG::unlog_xa_prepare

However, I can't tell whether it fixed the issue or just hid it.

Comment by Nikita Malyavin [ 2020-10-22 ]

Fixed in 4102f1589c23309de968a5bf9511d3228a1b9319 by monty

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