[MDEV-32593] Assertion failure upon CREATE SEQUENCE within transaction Created: 2023-10-26  Updated: 2023-10-31  Resolved: 2023-10-27

Status: Closed
Project: MariaDB Server
Component/s: Replication, Sequences
Affects Version/s: 10.4
Fix Version/s: 10.4.32, 10.5.23, 10.6.16, 10.10.7, 10.11.6, 11.0.4, 11.1.3, 11.2.2, 11.3.1

Type: Bug Priority: Blocker
Reporter: Elena Stepanova Assignee: Andrei Elkin
Resolution: Fixed Votes: 0
Labels: regression


 Description   

--source include/have_innodb.inc
--source include/have_log_bin.inc
 
CREATE TABLE t (a INT) ENGINE=InnoDB;
START TRANSACTION;
INSERT INTO t VALUES (1);
CREATE SEQUENCE s;
 
# Cleanup
DROP SEQUENCE s;
DROP TABLE t;

10.4 c9f87b88

mysqld: /data/src/10.4/sql/log_event.cc:8027: Gtid_log_event::Gtid_log_event(THD*, uint64, uint32, bool, uint16, bool, uint64): Assertion `thd_arg->lex->sql_command != SQLCOM_CREATE_SEQUENCE || (flags2 & FL_DDL)' failed.
231027  2:15:00 [ERROR] mysqld got signal 6 ;
 
#9  0x00007faf36a33e32 in __GI___assert_fail (assertion=0x556e362d9ca0 "thd_arg->lex->sql_command != SQLCOM_CREATE_SEQUENCE || (flags2 & FL_DDL)", file=0x556e362d17e0 "/data/src/10.4/sql/log_event.cc", line=8027, function=0x556e362d9d20 "Gtid_log_event::Gtid_log_event(THD*, uint64, uint32, bool, uint16, bool, uint64)") at ./assert/assert.c:101
#10 0x0000556e3492a36b in Gtid_log_event::Gtid_log_event (this=0x7faf21ccb4c0, thd_arg=0x62b0000af208, seq_no_arg=2, domain_id_arg=0, standalone=false, flags_arg=8, is_transactional=true, commit_id_arg=0) at /data/src/10.4/sql/log_event.cc:8027
#11 0x0000556e348d20d6 in MYSQL_BIN_LOG::write_gtid_event (this=0x556e377f1960 <mysql_bin_log>, thd=0x62b0000af208, standalone=false, is_transactional=true, commit_id=0) at /data/src/10.4/sql/log.cc:6100
#12 0x0000556e348dfe7d in MYSQL_BIN_LOG::write_transaction_or_stmt (this=0x556e377f1960 <mysql_bin_log>, entry=0x7faf21ccbb10, commit_id=0) at /data/src/10.4/sql/log.cc:8340
#13 0x0000556e348ddc39 in MYSQL_BIN_LOG::trx_group_commit_leader (this=0x556e377f1960 <mysql_bin_log>, leader=0x7faf21ccbb10) at /data/src/10.4/sql/log.cc:8093
#14 0x0000556e348dc7e9 in MYSQL_BIN_LOG::write_transaction_to_binlog_events (this=0x556e377f1960 <mysql_bin_log>, entry=0x7faf21ccbb10) at /data/src/10.4/sql/log.cc:7887
#15 0x0000556e348da52c in MYSQL_BIN_LOG::write_transaction_to_binlog (this=0x556e377f1960 <mysql_bin_log>, thd=0x62b0000af208, cache_mngr=0x61b00006ac88, end_ev=0x7faf21ccbda0, all=true, using_stmt_cache=true, using_trx_cache=true) at /data/src/10.4/sql/log.cc:7482
#16 0x0000556e348b7536 in binlog_flush_cache (thd=0x62b0000af208, cache_mngr=0x61b00006ac88, end_ev=0x7faf21ccbda0, all=true, using_stmt=true, using_trx=true) at /data/src/10.4/sql/log.cc:1762
#17 0x0000556e348b8195 in binlog_commit_flush_xid_caches (thd=0x62b0000af208, cache_mngr=0x61b00006ac88, all=true, xid=26) at /data/src/10.4/sql/log.cc:1870
#18 0x0000556e348ea116 in MYSQL_BIN_LOG::log_and_order (this=0x556e377f1960 <mysql_bin_log>, thd=0x62b0000af208, xid=26, all=true, need_prepare_ordered=false, need_commit_ordered=true) at /data/src/10.4/sql/log.cc:9854
#19 0x0000556e345dbe68 in ha_commit_trans (thd=0x62b0000af208, all=true) at /data/src/10.4/sql/handler.cc:1680
#20 0x0000556e3425cf49 in trans_commit_implicit (thd=0x62b0000af208) at /data/src/10.4/sql/transaction.cc:302
#21 0x0000556e33e2f753 in mysql_execute_command (thd=0x62b0000af208) at /data/src/10.4/sql/sql_parse.cc:3786
#22 0x0000556e33e4c783 in mysql_parse (thd=0x62b0000af208, rawbuf=0x62b0000b6228 "CREATE SEQUENCE s", length=17, parser_state=0x7faf21cce860, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8013
#23 0x0000556e33e229ae in dispatch_command (command=COM_QUERY, thd=0x62b0000af208, packet=0x62900029e209 "CREATE SEQUENCE s", packet_length=17, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1857
#24 0x0000556e33e1f51d in do_command (thd=0x62b0000af208) at /data/src/10.4/sql/sql_parse.cc:1378
#25 0x0000556e34220726 in do_handle_one_connection (connect=0x608000000ba8) at /data/src/10.4/sql/sql_connect.cc:1420
#26 0x0000556e3422003d in handle_one_connection (arg=0x608000000ba8) at /data/src/10.4/sql/sql_connect.cc:1324
#27 0x0000556e34e9295e in pfs_spawn_thread (arg=0x615000006488) at /data/src/10.4/storage/perfschema/pfs.cc:1869
#28 0x00007faf36a88044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#29 0x00007faf36b0861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

The failure started happening after this commit in 10.4:

commit 1fe4a71b67020a4fe3c1327df62668c11a0acb85
Author: Andrei
Date:   Mon Oct 23 12:53:12 2023 +0300
 
    MDEV-31792 Assertion fails in MDL_context::acquire_lock upon parallel replication of CREATE SEQUENCE
    
    The assert's reason was in missed FL_DDL flagging of CREATE-or-REPLACE



 Comments   
Comment by Andrei Elkin [ 2023-10-27 ]

Thanks elenst for finding it so quick!

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