[MDEV-31128] Server crashes in Rows_log_event::find_row upon concurrent DML and ALTER Created: 2023-04-25  Updated: 2024-01-01  Resolved: 2024-01-01

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table
Affects Version/s: N/A
Fix Version/s: 11.2.1

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Nikita Malyavin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
PartOf
is part of MDEV-31058 ER_KEY_NOT_FOUND upon concurrent CHAN... Closed
Problem/Incident
is caused by MDEV-16329 Engine-independent online ALTER TABLE Closed
is caused by MDEV-31058 ER_KEY_NOT_FOUND upon concurrent CHAN... Closed
Relates
relates to MDEV-28808 Test MDEV-16329 (ALTER ONLINE TABLE) ... Stalled

 Description   

--source include/have_debug_sync.inc
 
CREATE TABLE t (a INT, b INT, KEY id(b));
INSERT INTO t VALUES (1,1),(2,2);
 
--connect (con1,localhost,root,,)
SET debug_sync= 'alter_table_online_before_lock SIGNAL doupdate WAIT_FOR goforit';
--send
  ALTER TABLE t MODIFY COLUMN IF EXISTS id SERIAL FIRST, ALGORITHM=COPY, LOCK=NONE;
 
--connection default
SET debug_sync='now WAIT_FOR doupdate';
UPDATE t SET a = 116 LIMIT 1;
SET debug_sync='now SIGNAL goforit';
 
--connection con1
--reap
 
# Cleanup
DROP TABLE t;
--disconnect con1

bb-11.0-oalter fba3500cd8

#3  <signal handler called>
#4  0x000056214572fb6c in Rows_log_event::find_row (this=0x7f51e8026408, rgi=0x7f52056d4f50) at /data/src/bb-11.0-oalter-debug/sql/log_event_server.cc:7380
#5  0x000056214573173f in Update_rows_log_event::do_exec_row (this=0x7f51e8026408, rgi=0x7f52056d4f50) at /data/src/bb-11.0-oalter-debug/sql/log_event_server.cc:7879
#6  0x000056214572828f in Rows_log_event::do_apply_event (this=0x7f51e8026408, rgi=0x7f52056d4f50) at /data/src/bb-11.0-oalter-debug/sql/log_event_server.cc:5085
#7  0x000056214571275c in Log_event::apply_event (this=0x7f51e8026408, rgi=0x7f52056d4f50) at /data/src/bb-11.0-oalter-debug/sql/log_event.cc:3861
#8  0x00005621452cfe32 in online_alter_read_from_binlog (thd=0x7f51e8000dc8, rgi=0x7f52056d4f50, log=0x7f51e80277f0, unsafe_autoinc=true) at /data/src/bb-11.0-oalter-debug/sql/sql_table.cc:11649
#9  0x00005621452d1bb6 in copy_data_between_tables (thd=0x7f51e8000dc8, from=0x7f51f419a058, to=0x7f51e801fe18, create=..., ignore=false, order_num=0, order=0x0, copied=0x7f52056d8e50, deleted=0x7f52056d8e58, keys_onoff=Alter_info::LEAVE_AS_IS, alter_ctx=0x7f52056da420, online=true, online_unsafe_autoinc=true) at /data/src/bb-11.0-oalter-debug/sql/sql_table.cc:12089
#10 0x00005621452ce313 in mysql_alter_table (thd=0x7f51e8000dc8, new_db=0x7f51e8005ae0, new_name=0x7f51e8005f28, create_info=0x7f52056db240, table_list=0x7f51e8014128, recreate_info=0x7f52056db110, alter_info=0x7f52056db150, order_num=0, order=0x0, ignore=false, if_exists=false) at /data/src/bb-11.0-oalter-debug/sql/sql_table.cc:11112
#11 0x000056214538ca23 in Sql_cmd_alter_table::execute (this=0x7f51e8014a40, thd=0x7f51e8000dc8) at /data/src/bb-11.0-oalter-debug/sql/sql_alter.cc:563
#12 0x000056214519cd9f in mysql_execute_command (thd=0x7f51e8000dc8, is_called_from_prepared_stmt=false) at /data/src/bb-11.0-oalter-debug/sql/sql_parse.cc:6001
#13 0x00005621451a2f16 in mysql_parse (thd=0x7f51e8000dc8, rawbuf=0x7f51e8013fe0 "ALTER TABLE t MODIFY COLUMN IF EXISTS id SERIAL FIRST, ALGORITHM=COPY, LOCK=NONE", length=80, parser_state=0x7f52056dc370) at /data/src/bb-11.0-oalter-debug/sql/sql_parse.cc:7997
#14 0x000056214518eb81 in dispatch_command (command=COM_QUERY, thd=0x7f51e8000dc8, packet=0x7f51e800ba79 "", packet_length=80, blocking=true) at /data/src/bb-11.0-oalter-debug/sql/sql_parse.cc:1894
#15 0x000056214518d4e8 in do_command (thd=0x7f51e8000dc8, blocking=true) at /data/src/bb-11.0-oalter-debug/sql/sql_parse.cc:1407
#16 0x0000562145380e62 in do_handle_one_connection (connect=0x5621484f6a98, put_in_cache=true) at /data/src/bb-11.0-oalter-debug/sql/sql_connect.cc:1416
#17 0x0000562145380bd7 in handle_one_connection (arg=0x5621484f6a98) at /data/src/bb-11.0-oalter-debug/sql/sql_connect.cc:1318
#18 0x00005621458a131a in pfs_spawn_thread (arg=0x5621484f6b78) at /data/src/bb-11.0-oalter-debug/storage/perfschema/pfs.cc:2201
#19 0x00007f520b8a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#20 0x00007f520b9285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Reproducible with at least InnoDB, MyISAM, Aria.



 Comments   
Comment by Nikita Malyavin [ 2023-04-28 ]

I'll include the test and fix in MDEV-31058 and close altogether

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