[MDEV-6814] Server crashes in calculate_key_len on query with ORDER BY Created: 2014-09-30  Updated: 2014-09-30  Resolved: 2014-09-30

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: N/A
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: order-by-optimization


 Description   

Reproducible on bb-10.1-orderby-fixes revision 0b15557c8fec3de5c3ef3cce2b5ff9340159751f.
Could not reproduce on 10.1.0 or on the current 10.1 tree.

#3  <signal handler called>
#4  0x00007f5a5132af45 in calculate_key_len (table=0x7f5a464a3870, key=4294967295, buf=0x7f5a4658b048 "\001", keypart_map=0) at 10.1-orderby-fixes/sql/table.cc:3427
#5  0x00007f5a5146e842 in handler::prepare_index_key_scan_map (this=0x7f5a4647c888, key=0x7f5a4658b048 "\001", keypart_map=0) at 10.1-orderby-fixes/sql/handler.h:2618
#6  0x00007f5a512a82f5 in join_read_always_key (tab=0x7f5a4645b998) at 10.1-orderby-fixes/sql/sql_select.cc:18378
#7  0x00007f5a512a694a in sub_select (join=0x7f5a4658a0c0, join_tab=0x7f5a4645b998, end_of_records=false) at 10.1-orderby-fixes/sql/sql_select.cc:17635
#8  0x00007f5a512a6208 in do_select (join=0x7f5a4658a0c0, fields=0x7f5a48b457b8, table=0x0, procedure=0x0) at 10.1-orderby-fixes/sql/sql_select.cc:17298
#9  0x00007f5a51281d1a in JOIN::exec_inner (this=0x7f5a4658a0c0) at 10.1-orderby-fixes/sql/sql_select.cc:3093
#10 0x00007f5a5127ef72 in JOIN::exec (this=0x7f5a4658a0c0) at 10.1-orderby-fixes/sql/sql_select.cc:2388
#11 0x00007f5a512825cb in mysql_select (thd=0x7f5a48b41070, rref_pointer_array=0x7f5a48b45918, tables=0x7f5a465892b8, wild_num=1, fields=..., conds=0x7f5a46589d80, og_num=1, order=0x7f5a46589fb8, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f5a4658a0a0, unit=0x7f5a48b44fb8, select_lex=0x7f5a48b456a0) at 10.1-orderby-fixes/sql/sql_select.cc:3320
#12 0x00007f5a5127854e in handle_select (thd=0x7f5a48b41070, lex=0x7f5a48b44ef0, result=0x7f5a4658a0a0, setup_tables_done_option=0) at 10.1-orderby-fixes/sql/sql_select.cc:372
#13 0x00007f5a5124a8ac in execute_sqlcom_select (thd=0x7f5a48b41070, all_tables=0x7f5a465892b8) at 10.1-orderby-fixes/sql/sql_parse.cc:5729
#14 0x00007f5a51240ef1 in mysql_execute_command (thd=0x7f5a48b41070) at 10.1-orderby-fixes/sql/sql_parse.cc:2808
#15 0x00007f5a5124dad2 in mysql_parse (thd=0x7f5a48b41070, rawbuf=0x7f5a46589088 "SELECT * FROM t1 WHERE f1 < 3 AND f2 IS NULL ORDER BY f1", length=56, parser_state=0x7f5a45fb51c0) at 10.1-orderby-fixes/sql/sql_parse.cc:7011
#16 0x00007f5a5123dbc0 in dispatch_command (command=COM_QUERY, thd=0x7f5a48b41070, packet=0x7f5a48b37071 "", packet_length=56) at 10.1-orderby-fixes/sql/sql_parse.cc:1468
#17 0x00007f5a5123c9e0 in do_command (thd=0x7f5a48b41070) at 10.1-orderby-fixes/sql/sql_parse.cc:1092
#18 0x00007f5a513694cc in do_handle_one_connection (thd_arg=0x7f5a48b41070) at 10.1-orderby-fixes/sql/sql_connect.cc:1394
#19 0x00007f5a51369211 in handle_one_connection (arg=0x7f5a48b41070) at 10.1-orderby-fixes/sql/sql_connect.cc:1305
#20 0x00007f5a518f45b2 in pfs_spawn_thread (arg=0x7f5a4e0226f0) at 10.1-orderby-fixes/storage/perfschema/pfs.cc:1860
#21 0x00007f5a50953b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#22 0x00007f5a4e9ea20d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

Test case

CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, KEY(f2),KEY(f2,f1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,5,0),(2,6,0);
SELECT * FROM t1 WHERE f1 < 3 AND f2 IS NULL ORDER BY f1;



 Comments   
Comment by Sergei Petrunia [ 2014-09-30 ]

Fix pushed into bb-10.1-orderby-fixes tree.

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