[MDEV-31451] Assertion `marked_for_write_or_computed()' failed upon concurrent DML and DDL Created: 2023-06-10  Updated: 2023-06-10

Status: Open
Project: MariaDB Server
Component/s: Data Manipulation - Update, Stored routines
Affects Version/s: 11.1
Fix Version/s: 11.1

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Notes:

  • The test case is non-deterministic, run with --repeat=N. It usually fails for me within several runs, but it can vary on different machines and builds.
  • The first two lines in the test case are not necessary (it does not have to be InnoDB), the failure is reproducible with Aria and MyISAM, too; but it seems to take longer with MyISAM, and besides, the test case uses FOREIGN KEY at the end, so with InnoDB it is more meaningful.
  • I do not know why ALTER .. FOREIGN KEY is important here and what its role is, especially when the test is run with MyISAM and Aria. But I couldn't get rid of it.

--source include/have_innodb.inc
set default_storage_engine= InnoDB;
 
CREATE TABLE t1 (f INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (id INT PRIMARY KEY, x INT);
CREATE TABLE t3 (id INT PRIMARY KEY, a INT);
 
--delimiter $
CREATE TRIGGER tr AFTER UPDATE ON t1 FOR EACH ROW BEGIN UPDATE t2 SET x = 0 ; CALL f () ;  END $
--delimiter ;
 
--connect (con1,localhost,root,,)
--send
  UPDATE t1 SET f = 8;
 
--connection default
CREATE PROCEDURE f () UPDATE t3 SET a = NULL ;
ALTER TABLE t2 ADD CONSTRAINT FOREIGN KEY (id) REFERENCES t3 (id);
 
--connection con1
--reap
 
# Cleanup
DROP PROCEDURE f;
DROP TABLE t2, t3, t1;

11.1 3883eb63

mariadbd: /data/src/11.1/sql/field.cc:4431: virtual int Field_long::store(longlong, bool): Assertion `marked_for_write_or_computed()' failed.
230610 19:27:56 [ERROR] mysqld got signal 6 ;
 
#9  0x00007fb1b3c53df2 in __GI___assert_fail (assertion=0x55b446402840 "marked_for_write_or_computed()", file=0x55b446401600 "/data/src/11.1/sql/field.cc", line=4431, function=0x55b446404a20 "virtual int Field_long::store(longlong, bool)") at ./assert/assert.c:101
#10 0x000055b444715eff in Field_long::store (this=0x619000169f10, nr=8, unsigned_val=false) at /data/src/11.1/sql/field.cc:4431
#11 0x000055b44481d31e in save_int_value_in_field (field=0x619000169f10, nr=8, null_value=false, unsigned_flag=false) at /data/src/11.1/sql/item.cc:6944
#12 0x000055b44481d42f in Item_int::save_in_field (this=0x629000307bc0, field=0x619000169f10, no_conversions=false) at /data/src/11.1/sql/item.cc:6950
#13 0x000055b443cf00c4 in fill_record (thd=0x62b0001b9218, table_arg=0x619000169998, fields=..., values=..., ignore_errors=false, update=true) at /data/src/11.1/sql/sql_base.cc:9026
#14 0x000055b443cf129f in fill_record_n_invoke_before_triggers (thd=0x62b0001b9218, table=0x619000169998, fields=..., values=..., ignore_errors=false, event=TRG_EVENT_UPDATE) at /data/src/11.1/sql/sql_base.cc:9200
#15 0x000055b4441ffd54 in Sql_cmd_update::update_single_table (this=0x629000307c78, thd=0x62b0001b9218) at /data/src/11.1/sql/sql_update.cc:922
#16 0x000055b444214b7b in Sql_cmd_update::execute_inner (this=0x629000307c78, thd=0x62b0001b9218) at /data/src/11.1/sql/sql_update.cc:3059
#17 0x000055b444060142 in Sql_cmd_dml::execute (this=0x629000307c78, thd=0x62b0001b9218) at /data/src/11.1/sql/sql_select.cc:33338
#18 0x000055b443e81b4b in mysql_execute_command (thd=0x62b0001b9218, is_called_from_prepared_stmt=false) at /data/src/11.1/sql/sql_parse.cc:4393
#19 0x000055b443e991f5 in mysql_parse (thd=0x62b0001b9218, rawbuf=0x629000307238 "UPDATE t1 SET f = 8", length=19, parser_state=0x7fb1a36bda30) at /data/src/11.1/sql/sql_parse.cc:7769
#20 0x000055b443e716fc in dispatch_command (command=COM_QUERY, thd=0x62b0001b9218, packet=0x629000613219 "UPDATE t1 SET f = 8", packet_length=19, blocking=true) at /data/src/11.1/sql/sql_parse.cc:1892
#21 0x000055b443e6e439 in do_command (thd=0x62b0001b9218, blocking=true) at /data/src/11.1/sql/sql_parse.cc:1405
#22 0x000055b444335602 in do_handle_one_connection (connect=0x608000003db8, put_in_cache=true) at /data/src/11.1/sql/sql_connect.cc:1416
#23 0x000055b444334fc3 in handle_one_connection (arg=0x608000003b38) at /data/src/11.1/sql/sql_connect.cc:1318
#24 0x000055b444f50ed2 in pfs_spawn_thread (arg=0x617000008598) at /data/src/11.1/storage/perfschema/pfs.cc:2201
#25 0x00007fb1b3ca7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#26 0x00007fb1b3d285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

The failure started happening in 11.1 after a set of commits related to MDEV-7487 and MDEV-28883. The first buildable commit where I can reproduce it is

commit 554278e24dbc2c0af9fcfd66c54ca6a99a3cf17f 
    MDEV-7487 Semi-join optimization for single-table update/delete statements

but more likely it is related to

commit 3a9358a4106a1bd0ae2414f6f0bda50afdd65f0a
     MDEV-28883 Re-design the upper level of handling UPDATE and DELETE statements

which I cannot build.


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