[MDEV-31027] Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed in Diagnostics_area::set_ok_status on EXECUTE of prepared statement with savepoint Created: 2023-04-08  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Prepared Statements, Storage Engine - InnoDB
Affects Version/s: 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 11.0, 11.1
Fix Version/s: 10.6, 10.11, 11.0

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Thirunarayanan Balathandayuthapani
Resolution: Unresolved Votes: 0
Labels: regression-10.6

Issue Links:
Relates
relates to MDEV-24621 In bulk insert, pre-sort and build in... Closed
relates to MDEV-31026 MDEV-25460 Split: Assertion `! is_set... Confirmed

 Description   

Possibly related to MDEV-25460 and MDEV-24621

SET unique_checks=0,foreign_key_checks=0,autocommit=0;
SET @c:='SAVEPOINT sp0';
PREPARE s FROM @c;
CREATE TABLE t (id INT,DATA CHAR,PRIMARY KEY(id)) ENGINE=InnoDB;
INSERT INTO t VALUES (0);
SAVEPOINT sp0;
INSERT INTO t VALUES (0,REPEAT (0,0)),(0,REPEAT (0,0)),(0,REPEAT (0,0)),(0,REPEAT (0,0)),(0,REPEAT (0,0)),(0,REPEAT (0,0)),(0,REPEAT (0,0)),(0,REPEAT (0,0));
INSERT INTO t VALUES (0,1);
SELECT * FROM t INTO OUTFILE 'o';
EXECUTE s;

Leads to:

11.1.0 2b61ff8f2221745f0a96855a0feb0825c426f993 (Debug)

mariadbd: /test/11.1_dbg/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.

11.1.0 2b61ff8f2221745f0a96855a0feb0825c426f993 (Debug)

Core was generated by `/test/MD070423-mariadb-11.1.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --cor'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=23221789324864)
    at ./nptl/pthread_kill.c:44
[Current thread is 1 (Thread 0x151ebe80f640 (LWP 571915))]
(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=23221789324864) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=23221789324864) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=23221789324864, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x0000151f04f96476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x0000151f04f7c7f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x0000151f04f7c71b in __assert_fail_base (fmt=0x151f05131150 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x559823a6ced8 "!is_set() || (m_status == DA_OK_BULK && is_bulk_op())", file=0x559823a6cdb8 "/test/11.1_dbg/sql/sql_error.cc", line=335, function=<optimized out>) at ./assert/assert.c:92
#6  0x0000151f04f8de96 in __GI___assert_fail (assertion=0x559823a6ced8 "!is_set() || (m_status == DA_OK_BULK && is_bulk_op())", file=0x559823a6cdb8 "/test/11.1_dbg/sql/sql_error.cc", line=335, function=0x559823a6cf10 "void Diagnostics_area::set_ok_status(ulonglong, ulonglong, const char*)") at ./assert/assert.c:101
#7  0x0000559822f1b6cf in Diagnostics_area::set_ok_status (this=0x151e5c006b70, affected_rows=affected_rows@entry=0, last_insert_id=last_insert_id@entry=0, message=message@entry=0x0) at /test/11.1_dbg/sql/sql_error.cc:335
#8  0x0000559822f699ee in my_ok (message=0x0, id=0, affected_rows_arg=0, thd=0x151e5c000d58) at /test/11.1_dbg/sql/sql_class.h:4426
#9  mysql_execute_command (thd=0x151e5c000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=true) at /test/11.1_dbg/sql/sql_parse.cc:5470
#10 0x0000559822f91eb8 in Prepared_statement::execute (this=this@entry=0x151e5c019388, expanded_query=expanded_query@entry=0x151ebe80dc90, open_cursor=open_cursor@entry=false) at /test/11.1_dbg/sql/sql_prepare.cc:4992
#11 0x0000559822f92254 in Prepared_statement::execute_loop (this=this@entry=0x151e5c019388, expanded_query=expanded_query@entry=0x151ebe80dc90, open_cursor=open_cursor@entry=false, packet=packet@entry=0x0, packet_end=packet_end@entry=0x0) at /test/11.1_dbg/sql/sql_prepare.cc:4415
#12 0x0000559822f92891 in mysql_sql_stmt_execute (thd=thd@entry=0x151e5c000d58) at /test/11.1_dbg/sql/sql_prepare.cc:3456
#13 0x0000559822f659d1 in mysql_execute_command (thd=thd@entry=0x151e5c000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.1_dbg/sql/sql_parse.cc:3960
#14 0x0000559822f6bf05 in mysql_parse (thd=thd@entry=0x151e5c000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x151ebe80e230) at /test/11.1_dbg/sql/sql_parse.cc:7760
#15 0x0000559822f6e099 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x151e5c000d58, packet=packet@entry=0x151e5c00ae49 "EXECUTE s", packet_length=packet_length@entry=9, blocking=blocking@entry=true) at /test/11.1_dbg/sql/sql_class.h:242
#16 0x0000559822f6fef5 in do_command (thd=0x151e5c000d58, blocking=blocking@entry=true) at /test/11.1_dbg/sql/sql_parse.cc:1405
#17 0x00005598230c1cfc in do_handle_one_connection (connect=<optimized out>, connect@entry=0x559826765128, put_in_cache=put_in_cache@entry=true) at /test/11.1_dbg/sql/sql_connect.cc:1416
#18 0x00005598230c1f5b in handle_one_connection (arg=0x559826765128) at /test/11.1_dbg/sql/sql_connect.cc:1318
#19 0x0000151f04fe8b43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#20 0x0000151f0507aa00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Bug confirmed present in:
MariaDB: 10.6.13 (dbg), 10.7.8 (dbg), 10.8.8 (dbg), 10.9.6 (dbg), 10.10.4 (dbg), 10.11.3 (dbg), 11.0.2 (dbg), 11.1.0 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.4.29 (dbg), 10.4.29 (opt), 10.5.20 (dbg), 10.5.20 (opt), 10.6.13 (opt), 10.7.8 (opt), 10.8.8 (opt), 10.9.6 (opt), 10.10.4 (opt), 10.11.3 (opt), 11.0.2 (opt), 11.1.0 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.40 (dbg), 5.7.40 (opt), 8.0.31 (dbg), 8.0.31 (opt)


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