[MDEV-15970]  Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failure and/or ER_KEY_NOT_FOUND upon TRUNCATE sequence under lock Created: 2018-04-22  Updated: 2018-05-14  Resolved: 2018-05-14

Status: Closed
Project: MariaDB Server
Component/s: Locking, Sequences
Affects Version/s: 10.3
Fix Version/s: 10.3.7

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


 Description   

CREATE OR REPLACE SEQUENCE s ENGINE=MyISAM;
LOCK TABLE s WRITE;
TRUNCATE TABLE s;
 
# Cleanup
DROP SEQUENCE s;

10.3 c39f8a80c9f

2018-04-22  4:39:13 9 [ERROR] mysqld: Can't find record in 's'
2018-04-22  4:39:13 9 [ERROR] mysqld: Can't find record in 's'
mysqld: /data/src/10.3/sql/sql_error.cc:335: void Diagnostics_area::set_ok_status(ulonglong, ulonglong, const char*): Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed.
180422  4:39:13 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fc02b03cee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x000055e6615a8607 in Diagnostics_area::set_ok_status (this=0x7fc014006038, affected_rows=0, last_insert_id=0, message=0x0) at /data/src/10.3/sql/sql_error.cc:335
#9  0x000055e6615578c8 in my_ok (thd=0x7fc014000b00, affected_rows_arg=0, id=0, message=0x0) at /data/src/10.3/sql/sql_class.h:4789
#10 0x000055e661a9ec6d in Sql_cmd_truncate_table::execute (this=0x7fc014015480, thd=0x7fc014000b00) at /data/src/10.3/sql/sql_truncate.cc:499
#11 0x000055e6615f4e47 in mysql_execute_command (thd=0x7fc014000b00) at /data/src/10.3/sql/sql_parse.cc:6282
#12 0x000055e6615f9914 in mysql_parse (thd=0x7fc014000b00, rawbuf=0x7fc014014d58 "TRUNCATE TABLE s", length=16, parser_state=0x7fc0251e35d0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8001
#13 0x000055e6615e70f7 in dispatch_command (command=COM_QUERY, thd=0x7fc014000b00, packet=0x7fc01408ff81 "TRUNCATE TABLE s", packet_length=16, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1846
#14 0x000055e6615e5b36 in do_command (thd=0x7fc014000b00) at /data/src/10.3/sql/sql_parse.cc:1391
#15 0x000055e661748659 in do_handle_one_connection (connect=0x55e664396e30) at /data/src/10.3/sql/sql_connect.cc:1402
#16 0x000055e6617483e6 in handle_one_connection (arg=0x55e664396e30) at /data/src/10.3/sql/sql_connect.cc:1308
#17 0x000055e661bcbebf in pfs_spawn_thread (arg=0x55e6643aa6d0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
#18 0x00007fc02cd13494 in start_thread (arg=0x7fc0251e4700) at pthread_create.c:333
#19 0x00007fc02b0f993f in clone () from /lib/x86_64-linux-gnu/libc.so.6

On a non-debug build, or on an InnoDB sequence, the assertion failure does not occur, but ER_KEY_NOT_FOUND is still there.



 Comments   
Comment by Michael Widenius [ 2018-05-14 ]

Problem was that we used table->s->db_type() for accessing
handlerton of opened file instead of table->file->ht

Other bug fixed:

  • Ensure that we set error if reopen_tables() fails. (This was the cause of assert)
Comment by Michael Widenius [ 2018-05-14 ]

Fix pushed

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