[MDEV-31779] Server crash in Rows_log_event::update_sequence upon replaying binary log Created: 2023-07-26  Updated: 2024-01-16

Status: In Progress
Project: MariaDB Server
Component/s: Replication, Sequences
Affects Version/s: 10.4, 10.5, 10.6, 10.9, 10.10, 10.11, 11.0, 11.1, 11.2, 11.3, 11.4
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2, 11.3, 11.4

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Andrei Elkin
Resolution: Unresolved Votes: 1
Labels: CS0689897

Issue Links:
Problem/Incident
is caused by MDEV-29621 Replica stopped by locks on sequence Closed
Relates
relates to MDEV-31775 Server crash in Rows_log_event::updat... Closed

 Description   

--source include/have_log_bin.inc
 
--let $datadir=`select @@datadir`
 
reset master;
create sequence s;
select nextval(s);
flush binary logs;
drop sequence s;
 
--exec $MYSQL_BINLOG $datadir/master-bin.000001 | $MYSQL test
show create sequence s;
 
# Cleanup
drop sequence s;

10.4 30f3db3c

#3  <signal handler called>
#4  0x00005585ac506e1e in Rows_log_event::update_sequence (this=0x61300006e0c8) at /data/src/10.4/sql/log_event.cc:13776
#5  0x00005585ac5055c9 in Rows_log_event::write_row (this=0x61300006e0c8, rgi=0x61d000244a80, overwrite=false) at /data/src/10.4/sql/log_event.cc:13591
#6  0x00005585ac50787e in Write_rows_log_event::do_exec_row (this=0x61300006e0c8, rgi=0x61d000244a80) at /data/src/10.4/sql/log_event.cc:13834
#7  0x00005585ac4f8cb9 in Rows_log_event::do_apply_event (this=0x61300006e0c8, rgi=0x61d000244a80) at /data/src/10.4/sql/log_event.cc:11678
#8  0x00005585ab78e808 in Log_event::apply_event (this=0x61300006e0c8, rgi=0x61d000244a80) at /data/src/10.4/sql/log_event.h:1492
#9  0x00005585abd6533e in mysql_client_binlog_statement (thd=0x62b00009a208) at /data/src/10.4/sql/sql_binlog.cc:355
#10 0x00005585ab9fa369 in mysql_execute_command (thd=0x62b00009a208) at /data/src/10.4/sql/sql_parse.cc:6135
#11 0x00005585aba065b1 in mysql_parse (thd=0x62b00009a208, rawbuf=0x62b0000a1228 "BINLOG '\nbz/BZBMBAAAAMwAAAEwCAAAAACAAAAAAAAEABHRlc3QAAXMACAgICAgICAEIAAAi1wZ2\nbz/BZBcBAAAAWwAAAKcCAAAAACAAAAAAAAEACP8A6QMAAAAAAAABAAAAAAAAAP7///////9/AQAA\nAAAAAAABAAAAAAAAAOgD", 'A' <repeats 20 times>, "eUzZs"..., length=205, parser_state=0x7f89a28db860, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8010
#12 0x00005585ab9dc87c in dispatch_command (command=COM_QUERY, thd=0x62b00009a208, packet=0x62900024e209 "BINLOG '\nbz/BZBMBAAAAMwAAAEwCAAAAACAAAAAAAAEABHRlc3QAAXMACAgICAgICAEIAAAi1wZ2\nbz/BZBcBAAAAWwAAAKcCAAAAACAAAAAAAAEACP8A6QMAAAAAAAABAAAAAAAAAP7///////9/AQAA\nAAAAAAABAAAAAAAAAOgD", 'A' <repeats 20 times>, "eUzZs"..., packet_length=205, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1857
#13 0x00005585ab9d93eb in do_command (thd=0x62b00009a208) at /data/src/10.4/sql/sql_parse.cc:1378
#14 0x00005585abdd807a in do_handle_one_connection (connect=0x608000000aa8) at /data/src/10.4/sql/sql_connect.cc:1420
#15 0x00005585abdd7991 in handle_one_connection (arg=0x608000000aa8) at /data/src/10.4/sql/sql_connect.cc:1324
#16 0x00005585aca46d5a in pfs_spawn_thread (arg=0x615000003f08) at /data/src/10.4/storage/perfschema/pfs.cc:1869
#17 0x00007f89aa8a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#18 0x00007f89aa9285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

The failure started happening on 10.4 after this merge in 10.4.29:

commit edd0b03e60f4cc666fbdf16e7b01b97188f2f887
Merge: ddcc9d2281d 55a53949bea
Author: Oleksandr Byelkin
Date:   Tue May 2 10:09:27 2023 +0200
 
    Merge branch '10.3' into 10.4

It doesn't fail on 10.3, but there were only a couple of commits in that merge, so it's easy to guess that the guilty one is

commit 55a53949beac6e212b1232d3628d96b9b8121a49
Author: Andrei
Date:   Sat Mar 18 21:11:07 2023 +0200
 
    MDEV-29621: Replica stopped by locks on sequence


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