[MDEV-16794] Assertion `thd->transaction.stmt.is_empty()' failed in Locked_tables_list::unlock_locked_tables upon ALTER TABLE Created: 2018-07-20  Updated: 2019-10-04  Resolved: 2019-10-04

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Locking
Affects Version/s: 10.0, 10.1
Fix Version/s: N/A

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Oleksandr Byelkin
Resolution: Won't Fix Votes: 0
Labels: affects-tests

Issue Links:
Duplicate
duplicates MDEV-11071 Assertion `thd->transaction.stmt.is_e... Closed
Relates
relates to MDEV-17314 Assertion `thd->transaction.stmt.is_e... Closed

 Description   

--source include/have_innodb.inc
 
CREATE TABLE t1 (pk INT PRIMARY KEY, c CHAR(125)) ENGINE=InnoDB;
LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD vc TEXT AS (SUBSTR(c,5,8)) VIRTUAL;
--error ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP FOREIGN KEY fk;
 
# Cleanup
DROP TABLE t1;

10.0 ada54101a71

mysqld: /data/src/10.0/sql/sql_base.cc:2792: void Locked_tables_list::unlock_locked_tables(THD*): Assertion `thd->transaction.stmt.is_empty()' failed.
180721  1:39:30 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f06478b6ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x00000000005ecff2 in Locked_tables_list::unlock_locked_tables (this=0x7f063c740878, thd=0x7f063c73d070) at /data/src/10.0/sql/sql_base.cc:2792
#9  0x00000000005ed362 in Locked_tables_list::unlink_all_closed_tables (this=0x7f063c740878, thd=0x7f063c73d070, lock=0x0, reopen_count=0) at /data/src/10.0/sql/sql_base.cc:2970
#10 0x00000000005ed4da in Locked_tables_list::reopen_tables (this=0x7f063c740878, thd=0x7f063c73d070, need_reopen=false) at /data/src/10.0/sql/sql_base.cc:3016
#11 0x00000000007023a5 in mysql_inplace_alter_table (thd=0x7f063c73d070, table_list=0x7f06338fa180, table=0x7f063389e470, altered_table=0x7f0633a11070, ha_alter_info=0x7f064997a260, inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7f0649979cb0, alter_ctx=0x7f064997a840) at /data/src/10.0/sql/sql_table.cc:7269
#12 0x000000000070662e in mysql_alter_table (thd=0x7f063c73d070, new_db=0x7f06338fa760 "test", new_name=0x0, create_info=0x7f064997b4e0, table_list=0x7f06338fa180, alter_info=0x7f064997b450, order_num=0, order=0x0, ignore=false) at /data/src/10.0/sql/sql_table.cc:8976
#13 0x000000000076f339 in Sql_cmd_alter_table::execute (this=0x7f06338fa790, thd=0x7f063c73d070) at /data/src/10.0/sql/sql_alter.cc:312
#14 0x00000000006547e4 in mysql_execute_command (thd=0x7f063c73d070) at /data/src/10.0/sql/sql_parse.cc:5118
#15 0x0000000000657e3a in mysql_parse (thd=0x7f063c73d070, rawbuf=0x7f06338fa088 "ALTER TABLE t1 DROP FOREIGN KEY fk", length=34, parser_state=0x7f064997c640) at /data/src/10.0/sql/sql_parse.cc:6637
#16 0x000000000064a75a in dispatch_command (command=COM_QUERY, thd=0x7f063c73d070, packet=0x7f063ca60071 "ALTER TABLE t1 DROP FOREIGN KEY fk", packet_length=34) at /data/src/10.0/sql/sql_parse.cc:1300
#17 0x0000000000649a5a in do_command (thd=0x7f063c73d070) at /data/src/10.0/sql/sql_parse.cc:1003
#18 0x000000000076aa8c in do_handle_one_connection (thd_arg=0x7f063c73d070) at /data/src/10.0/sql/sql_connect.cc:1377
#19 0x000000000076a7fe in handle_one_connection (arg=0x7f063c73d070) at /data/src/10.0/sql/sql_connect.cc:1292
#20 0x0000000000acc90a in pfs_spawn_thread (arg=0x7f063c6801f0) at /data/src/10.0/storage/perfschema/pfs.cc:1861
#21 0x00007f06495ba494 in start_thread (arg=0x7f064997d700) at pthread_create.c:333
#22 0x00007f064797393f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Reproducible on 10.0, 10.1.
Couldn't reproduce on 10.2, 10.3.
No visible problems on a non-debug build.



 Comments   
Comment by Sergey Vojtovich [ 2019-06-11 ]

Verified to be duplicate of MDEV-11071, fixed in 10.2 by

commit 6b8802e8dd5467556a024d807a1df23940b00895
Author: Oleksandr Byelkin <sanja@mariadb.com>
Date:   Tue May 8 15:26:26 2018 +0200
 
    MDEV-11071: Assertion `thd->transaction.stmt.is_empty()' failed in Locked_tables_list::unlock_locked_table
 
    fix_length_and_dec now return result (error/OK)

Comment by Sergey Vojtovich [ 2019-06-11 ]

sanja, I leave it up to you to decide whether backporting to 10.1 is feasible.

Comment by Oleksandr Byelkin [ 2019-07-11 ]

it looks more like reemplementing...

Comment by Elena Stepanova [ 2019-10-04 ]

Closing, as according to the comments it was fixed in 10.2+ and it would be a major effort to backport it, while according to the description it has no obvious effect on release builds, thus not worth it.

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