[MDEV-239] SHOW EXPLAIN: Assertion `field_types == 0 || field_types[field_pos] == MYSQL_TYPE_DOUBLE' failed in Protocol_text::store(double, uint32, String*) with SHOW EXPLAIN over EXPLAIN EXTENDED Created: 2012-05-01  Updated: 2012-05-11  Resolved: 2012-05-11

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: 10.0.0

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-165 MWL#182: Explain running statements: ... Closed
relates to MDEV-238 SHOW EXPLAIN: Server crashes in JOIN:... Closed

 Description   

It might be closely related to MDEV-238, as the grammar is the same, except that here we run EXPLAIN EXTENDED over the query, and SHOW EXPLAIN on EXPLAIN EXTENDED.
While executing it on purpose might be not very reasonable, due to the concurrent nature of the feature, it might hit a "wrong" statement unintentionally.

 
mysqld: protocol.cc:1061: virtual bool Protocol_text::store(double, uint32, String*): Assertion `field_types == 0 || field_types[field_pos] == MYSQL_TYPE_DOUBLE' failed.
 
#3  <signal handler called>
#4  0x00007f54906bb3a5 in __GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#5  0x00007f54906beb0b in __GI_abort () at abort.c:92
#6  0x00007f54906b3d4d in __GI___assert_fail (assertion=0xd84c90 "field_types == 0 || field_types[field_pos] == MYSQL_TYPE_DOUBLE", 
    file=<optimized out>, line=1061, function=<optimized out>) at assert.c:81
#7  0x00000000006afee7 in Protocol_text::store (this=0x45f8d28, from=100, decimals=2, buffer=0x7f54699b4320) at protocol.cc:1060
#8  0x00000000005d37f5 in Item::send (this=0x4607638, protocol=0x45f8d28, buffer=0x7f54699b4320) at item.cc:6006
#9  0x00000000006a02e4 in select_result_explain_buffer::send_data (this=0x4607208, items=...) at sql_class.cc:2061
#10 0x00000000007839e5 in JOIN::print_explain (this=0x460b568, result=0x4607208, on_the_fly=true, need_tmp_table=false, 
    need_order=false, distinct=false, message=0x0) at sql_select.cc:21695
#11 0x00000000005ae503 in st_select_lex::print_explain (this=0x436e848, output=0x4607208) at sql_lex.cc:3758
#12 0x00000000005ae65a in st_select_lex_unit::print_explain (this=0x436e340, output=0x4607208) at sql_lex.cc:3807
#13 0x00000000006a40a4 in Show_explain_request::get_explain_data (arg=0x7f5469a45bb0) at sql_class.cc:3042
#14 0x000000000093d0b6 in Apc_target::process_apc_requests (this=0x436e0b0) at my_apc.cc:255
#15 0x000000000093ca9a in Apc_target::disable (this=0x436e0b0) at my_apc.cc:83
#16 0x0000000000751228 in JOIN::exec (this=0x460b568) at sql_select.cc:2126
#17 0x0000000000754795 in mysql_select (thd=0x436bd98, rref_pointer_array=0x436eaa0, tables=0x44f76f8, wild_num=0, fields=..., 
    conds=0x0, og_num=1, order=0x0, group=0x44f92f8, having=0x0, proc_param=0x0, select_options=2147764740, result=0x44f93d8, 
    unit=0x436e340, select_lex=0x436e848) at sql_select.cc:3023
#18 0x0000000000783fb4 in mysql_explain_union (thd=0x436bd98, unit=0x436e340, result=0x44f93d8) at sql_select.cc:21786
#19 0x00000000006d7d1a in execute_sqlcom_select (thd=0x436bd98, all_tables=0x44f76f8) at sql_parse.cc:5157
#20 0x00000000006ceb33 in mysql_execute_command (thd=0x436bd98) at sql_parse.cc:2285
#21 0x00000000006da94c in mysql_parse (thd=0x436bd98, 
    rawbuf=0x44f7480 "EXPLAIN EXTENDED SELECT alias.a FROM A, ( SELECT * FROM A ) AS alias GROUP BY alias.a", length=85, 
    found_semicolon=0x7f54699b67e8) at sql_parse.cc:6179
#22 0x00000000006cc2a3 in dispatch_command (command=COM_QUERY, thd=0x436bd98, packet=0x4647f49 "", packet_length=85)
    at sql_parse.cc:1229
#23 0x00000000006cb58a in do_command (thd=0x436bd98) at sql_parse.cc:924
#24 0x00000000006c8418 in handle_one_connection (arg=0x436bd98) at sql_connect.cc:1218
---Type <return> to continue, or q <return> to quit---
#25 0x00007f54911c0efc in start_thread (arg=0x7f54699b7700) at pthread_create.c:304
#26 0x00007f549076859d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

bzr version-info

revision-id: psergey@askmonty.org-20120426031831-0iujnre01v3tlwkf
date: 2012-04-26 08:48:31 +0530
build-date: 2012-05-01 07:11:29 +0400
revno: 3504

optimizer_switch (default):

index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on

Grammar to reproduce:

thread1_init:
  CREATE TABLE A ( a INT ) ENGINE=MyISAM; INSERT INTO A VALUES (1),(2),(1),(4),(2);
 
thread2_init:
  SET @con_id = CONNECTION_ID()-1;
 
query:
  EXPLAIN EXTENDED SELECT alias.a FROM A, ( SELECT * FROM A ) AS alias GROUP BY alias.a ;
 
thread2:
  SHOW EXPLAIN FOR @con_id;

Run as:

perl ./runall.pl \
--queries=100M \
--threads=2 \
--duration=600 \
--grammar=2.yy \
--skip-gendata \
--basedir=<basedir> \ 
--vardir=<vardir>



 Comments   
Comment by Sergei Petrunia [ 2012-05-11 ]

Fix pushed to 5.3-show-explain2

Generated at Thu Feb 08 06:27:16 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.