[MDEV-14572] Assertion `! is_set()' failed in Diagnostics_area::set_eof_status upon EXPLAIN UPDATE in PS Created: 2017-12-04  Updated: 2019-05-08  Resolved: 2019-04-30

Status: Closed
Project: MariaDB Server
Component/s: Data Manipulation - Update, Prepared Statements
Affects Version/s: 10.0, 10.1, 10.2, 10.3
Fix Version/s: 10.2.24, 10.1.41, 10.3.15, 10.4.5

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

Sprint: 10.2.12, 10.1.31

 Description   

CREATE TABLE t1 (a INT);
CREATE TABLE t2 (b INT);
 
PREPARE stmt FROM 'EXPLAIN UPDATE t1, t2 SET a = 1';
EXECUTE stmt;
 
# Cleanup
DROP TABLE t1, t2;

10.0 d8ccc61f76d56

mysqld: /data/src/10.0/sql/sql_error.cc:407: void Diagnostics_area::set_eof_status(THD*): Assertion `! is_set()' failed.
171205  1:57:04 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f4d15067ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x0000000000627afa in Diagnostics_area::set_eof_status (this=0x7f4d0f2a6d80, thd=0x7f4d0f2a2070) at /data/src/10.0/sql/sql_error.cc:407
#9  0x00000000005a8e98 in my_eof (thd=0x7f4d0f2a2070) at /data/src/10.0/sql/sql_class.h:3844
#10 0x000000000061247b in select_send::send_eof (this=0x7f4d0d8fc048) at /data/src/10.0/sql/sql_class.cc:2602
#11 0x00000000007980df in Explain_query::send_explain (this=0x7f4d0d8fbf38, thd=0x7f4d0f2a2070) at /data/src/10.0/sql/sql_explain.cc:147
#12 0x0000000000719891 in mysql_multi_update (thd=0x7f4d0f2a2070, table_list=0x7f4d0dbaf588, fields=0x7f4d0dbae960, values=0x7f4d0dbaee18, conds=0x0, options=268435456, handle_duplicates=DUP_ERROR, ignore=false, unit=0x7f4d0dbae158, select_lex=0x7f4d0dbae848, result=0x7f4d171366c0) at /data/src/10.0/sql/sql_update.cc:1606
#13 0x000000000064e621 in mysql_execute_command (thd=0x7f4d0f2a2070) at /data/src/10.0/sql/sql_parse.cc:3377
#14 0x000000000066f1ec in Prepared_statement::execute (this=0x7f4d0d981470, expanded_query=0x7f4d17136bd0, open_cursor=false) at /data/src/10.0/sql/sql_prepare.cc:3974
#15 0x000000000066e2be in Prepared_statement::execute_loop (this=0x7f4d0d981470, expanded_query=0x7f4d17136bd0, open_cursor=false, packet=0x0, packet_end=0x0) at /data/src/10.0/sql/sql_prepare.cc:3629
#16 0x000000000066c5ac in mysql_sql_stmt_execute (thd=0x7f4d0f2a2070) at /data/src/10.0/sql/sql_prepare.cc:2779
#17 0x000000000064c708 in mysql_execute_command (thd=0x7f4d0f2a2070) at /data/src/10.0/sql/sql_parse.cc:2563
#18 0x0000000000656dc2 in mysql_parse (thd=0x7f4d0f2a2070, rawbuf=0x7f4d0d8fa088 "EXECUTE stmt", length=12, parser_state=0x7f4d17137640) at /data/src/10.0/sql/sql_parse.cc:6569
#19 0x0000000000649901 in dispatch_command (command=COM_QUERY, thd=0x7f4d0f2a2070, packet=0x7f4d107e5071 "", packet_length=12) at /data/src/10.0/sql/sql_parse.cc:1296
#20 0x0000000000648c01 in do_command (thd=0x7f4d0f2a2070) at /data/src/10.0/sql/sql_parse.cc:999
#21 0x0000000000768ab8 in do_handle_one_connection (thd_arg=0x7f4d0f2a2070) at /data/src/10.0/sql/sql_connect.cc:1377
#22 0x000000000076882a in handle_one_connection (arg=0x7f4d0f2a2070) at /data/src/10.0/sql/sql_connect.cc:1292
#23 0x0000000000ac9564 in pfs_spawn_thread (arg=0x7f4d0f1a2370) at /data/src/10.0/storage/perfschema/pfs.cc:1861
#24 0x00007f4d16d6b494 in start_thread (arg=0x7f4d17138700) at pthread_create.c:333
#25 0x00007f4d1512493f in clone () from /lib/x86_64-linux-gnu/libc.so.6

No visible effect on non-debug builds.



 Comments   
Comment by Oleksandr Byelkin [ 2017-12-21 ]

First execution of Multi-update set OK, then explain set EOF.

set_eof_status/set_ok_status

Comment by Oleksandr Byelkin [ 2017-12-21 ]

select_options & SELECT_DESCRIBE is not set during SP execution

Comment by Oleksandr Byelkin [ 2017-12-22 ]

/* remove option which was put by mysql_explain_union() */
sl->options&= ~SELECT_DESCRIBE;

Above remove the flag, but in deference of INSERT/DELETE we do not (can not) use mysql_explain_union().

Comment by Oleksandr Byelkin [ 2017-12-22 ]

github tree: 10.0-bb-MDEV-14572

revision-id: 980a5c318803d6aa7355e019869597976dcf19bf (mariadb-10.0.33-37-g980a5c31880)
parent(s): 042f763268c0f209e7c12e0a6a72bb5d204dfe29
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2017-12-22 14:00:10 +0100
message:

MDEV-14572: Assertion `! is_set()' failed in Diagnostics_area::set_eof_status upon EXPLAIN UPDATE in PS

Restore EXPAIN flag in SELECT_LEX before execution multi-update by flag in LEX
(the same but in other way made before INSERT/DELETE/SELECT)

Comment by Oleksandr Byelkin [ 2018-06-11 ]

revision-id: 2c7c6f702262284ac8e5c0c2cdb6945d62fd8efc (mariadb-10.0.35-37-g2c7c6f70226)
parent(s): 24d7cbe1e0a16f75e2325c84f23531742e2a035d
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2018-06-11 17:32:51 +0200
message:

MDEV-14572: Assertion `! is_set()' failed in Diagnostics_area::set_eof_status upon EXPLAIN UPDATE in PS

Restore EXPAIN flag in SELECT_LEX before execution multi-update by flag in LEX
(the same but in other way made before INSERT/DELETE/SELECT)

Without it, mysql_update() didn't know that there will be EXPLAIN result set and was sending OK at the end of the update, which conflicted with the EOF sent later by EXPLAIN.

Comment by Sergei Golubchik [ 2018-07-12 ]

ok to push commit 2c7c6f70226

Generated at Thu Feb 08 08:14:37 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.