[MDEV-27204] [ERROR] Json_writer: a member name was expected, Assertion `got_name == named_item_expected()' failed Created: 2021-12-08  Updated: 2022-02-17  Resolved: 2021-12-09

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.8
Fix Version/s: 10.8.0

Type: Bug Priority: Blocker
Reporter: Elena Stepanova Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: affects-tests, regression

Issue Links:
Problem/Incident
is caused by MDEV-27036 Json_writer allows one to create dupl... Closed
Relates
relates to MDEV-27206 [ERROR] Duplicated key: cause, Assert... Closed
relates to MDEV-27238 Assertion `got_name == named_item_exp... Closed
relates to MDEV-27878 Assertion `got_name == named_item_exp... Open
Epic Link: Tracer JSON consistency

 Description   

CREATE TABLE t (a INT);
INSERT INTO t VALUES (1),(2);
 
ANALYZE FORMAT=JSON SELECT * FROM t t1 WHERE t1.a IN (SELECT t2.a FROM t t2 WHERE t1.a IN (SELECT t3.a FROM t t3));
 
# Cleanup
DROP TABLE t;

10.8 1e8bcbd0

2021-12-08 20:52:48 4 [ERROR] Json_writer: a member name was expected.
 
mariadbd: /data/src/10.8/sql/my_json_writer.cc:49: void Json_writer::on_start_object(): Assertion `got_name == named_item_expected()' failed.
211208 20:52:48 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f5a371e3f36 in __GI___assert_fail (assertion=0x564ddc8c6a28 "got_name == named_item_expected()", file=0x564ddc8c6a50 "/data/src/10.8/sql/my_json_writer.cc", line=49, function=0x564ddc8c6a78 "void Json_writer::on_start_object()") at assert.c:101
#8  0x0000564ddbd0f6bc in Json_writer::on_start_object (this=0x7f5a31a0c6f0) at /data/src/10.8/sql/my_json_writer.cc:49
#9  0x0000564ddbd0d7da in Json_writer::start_object (this=0x7f5a31a0c6f0) at /data/src/10.8/sql/my_json_writer.cc:59
#10 0x0000564ddb95b00e in Json_writer_object::Json_writer_object (this=0x7f5a31a0c510, writer=0x7f5a31a0c6f0, str=0x0) at /data/src/10.8/sql/my_json_writer.h:445
#11 0x0000564ddbcc3abc in Explain_table_access::print_explain_json (this=0x7f5a200606a0, query=0x7f5a20056288, writer=0x7f5a31a0c6f0, is_analyze=true) at /data/src/10.8/sql/sql_explain.cc:1694
#12 0x0000564ddbcc18a5 in Explain_basic_join::print_explain_json_interns (this=0x7f5a2005fc90, query=0x7f5a20056288, writer=0x7f5a31a0c6f0, is_analyze=true) at /data/src/10.8/sql/sql_explain.cc:1105
#13 0x0000564ddbcc1262 in Explain_select::print_explain_json (this=0x7f5a2005fc90, query=0x7f5a20056288, writer=0x7f5a31a0c6f0, is_analyze=true) at /data/src/10.8/sql/sql_explain.cc:1001
#14 0x0000564ddbcbe412 in Explain_query::print_explain_json (this=0x7f5a20056288, output=0x7f5a20060a18, is_analyze=true) at /data/src/10.8/sql/sql_explain.cc:234
#15 0x0000564ddbcbe141 in Explain_query::send_explain (this=0x7f5a20056288, thd=0x7f5a20000db8) at /data/src/10.8/sql/sql_explain.cc:177
#16 0x0000564ddbaaff9c in execute_sqlcom_select (thd=0x7f5a20000db8, all_tables=0x7f5a20015b38) at /data/src/10.8/sql/sql_parse.cc:6265
#17 0x0000564ddbaa7168 in mysql_execute_command (thd=0x7f5a20000db8, is_called_from_prepared_stmt=false) at /data/src/10.8/sql/sql_parse.cc:3944
#18 0x0000564ddbab4d2a in mysql_parse (thd=0x7f5a20000db8, rawbuf=0x7f5a20015400 "ANALYZE FORMAT=JSON SELECT * FROM t t1 WHERE t1.a IN (SELECT t2.a FROM t t2 WHERE t1.a IN (SELECT t3.a FROM t t3))", length=114, parser_state=0x7f5a31a0d480) at /data/src/10.8/sql/sql_parse.cc:8028
#19 0x0000564ddbaa117e in dispatch_command (command=COM_QUERY, thd=0x7f5a20000db8, packet=0x7f5a2000b989 "", packet_length=114, blocking=true) at /data/src/10.8/sql/sql_parse.cc:1894
#20 0x0000564ddba9fb1a in do_command (thd=0x7f5a20000db8, blocking=true) at /data/src/10.8/sql/sql_parse.cc:1402
#21 0x0000564ddbc75559 in do_handle_one_connection (connect=0x564ddefa0b18, put_in_cache=true) at /data/src/10.8/sql/sql_connect.cc:1418
#22 0x0000564ddbc751e9 in handle_one_connection (arg=0x564ddefa3178) at /data/src/10.8/sql/sql_connect.cc:1312
#23 0x0000564ddc1786a7 in pfs_spawn_thread (arg=0x564ddefa0668) at /data/src/10.8/storage/perfschema/pfs.cc:2201
#24 0x00007f5a376fc609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#25 0x00007f5a372cf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Reproducible with at least MyISAM and InnoDB.
Not reproducible on 10.7.
The failure appeared in 10.8 after this commit:

commit 73df7a30094a0fac8f59de1c91a7bce6cd3ff643
Author: Sergei Krivonos
Date:   Sun Nov 14 09:48:20 2021 +0200
 
    MDEV-27036: resolve duplicated key issues of JSON tracing outputs:



 Comments   
Comment by Sergei Krivonos (Inactive) [ 2021-12-09 ]

Hi psergei,
Please, review the fix https://buildbot.mariadb.org/#/grid?branch=bb-10.8-MDEV-27204
Once ok, I apply multiple test result file changes.

Comment by Sergei Petrunia [ 2021-12-09 ]

sergei.krivonos Ok to push this, but please use EXPLAIN FORMAT=JSON instead ANALYZE FORMAT=JSON in the test files.

Comment by Sergei Petrunia [ 2021-12-09 ]

Ok, the patch is needed sooner.
Adjusting it to pass tests: bb-10.8-MDEV-27204-v2

Comment by Sergei Petrunia [ 2021-12-09 ]

Pushed into 10.8, also cherry-picked to preview-10.8-MDEV-26519-json-histograms

Comment by Roel Van de Paar [ 2021-12-12 ]

See MDEV-27238

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