Bug #81413 Assertion `is_last_prefix <= 0' failed.
Submitted: 13 May 2016 4:54 Modified: 16 Dec 2019 22:29
Reporter: Roel Van de Paar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S6 (Debug Builds)
Version:5.5.49 OS:Any
Assigned to: CPU Architecture:Any

[13 May 2016 4:54] Roel Van de Paar
Description:
mysqld: /git/mysql-server/sql/opt_range.cc:11122: virtual int QUICK_GROUP_MIN_MAX_SELECT::get_next(): Assertion `is_last_prefix <= 0' failed.
04:35:42 UTC - mysqld got signal 6 ;

+bt
#0  0x00007fbe15283741 in __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x00000000007de0c8 in my_write_core (sig=6) at /git/mysql-server/mysys/stacktrace.c:433
#2  0x00000000006a1088 in handle_fatal_signal (sig=6) at /git/mysql-server/sql/signal_handler.cc:247
#3  <signal handler called>
#4  0x00007fbe142a45f7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007fbe142a5ce8 in __GI_abort () at abort.c:90
#6  0x00007fbe1429d566 in __assert_fail_base (fmt=0x7fbe143ed228 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0xb18269 "is_last_prefix <= 0", file=file@entry=0xb16cc8 "/git/mysql-server/sql/opt_range.cc", line=line@entry=11122, function=function@entry=0xb183a0 <QUICK_GROUP_MIN_MAX_SELECT::get_next()::__PRETTY_FUNCTION__> "virtual int QUICK_GROUP_MIN_MAX_SELECT::get_next()") at assert.c:92
#7  0x00007fbe1429d612 in __GI___assert_fail (assertion=0xb18269 "is_last_prefix <= 0", file=0xb16cc8 "/git/mysql-server/sql/opt_range.cc", line=11122, function=0xb183a0 <QUICK_GROUP_MIN_MAX_SELECT::get_next()::__PRETTY_FUNCTION__> "virtual int QUICK_GROUP_MIN_MAX_SELECT::get_next()") at assert.c:101
#8  0x0000000000775621 in QUICK_GROUP_MIN_MAX_SELECT::get_next (this=0x7fbd7b6ad000) at /git/mysql-server/sql/opt_range.cc:11122
#9  0x0000000000778d94 in rr_quick (info=0x7fbd7b664200) at /git/mysql-server/sql/records.cc:350
#10 0x00000000005aec8f in join_init_read_record (tab=0x7fbd7b664178) at /git/mysql-server/sql/sql_select.cc:12623
#11 0x00000000005b659d in sub_select (join=join@entry=0x7fbd7b666010, join_tab=join_tab@entry=0x7fbd7b664178, end_of_records=end_of_records@entry=false) at /git/mysql-server/sql/sql_select.cc:11848
#12 0x00000000005beaa4 in do_select (join=join@entry=0x7fbd7b666010, fields=fields@entry=0x0, table=table@entry=0x7fbd7b6f6010, procedure=procedure@entry=0x0) at /git/mysql-server/sql/sql_select.cc:11614
#13 0x00000000005d0b63 in JOIN::exec (this=0x7fbd7b662010) at /git/mysql-server/sql/sql_select.cc:2005
#14 0x0000000000711585 in subselect_single_select_engine::exec (this=0x7fbd7b626550) at /git/mysql-server/sql/item_subselect.cc:2050
#15 0x0000000000710ea3 in Item_subselect::exec (this=0x7fbd7b626460) at /git/mysql-server/sql/item_subselect.cc:277
#16 0x00000000007105cc in Item_singlerow_subselect::val_int (this=0x7fbd7b626460) at /git/mysql-server/sql/item_subselect.cc:591
#17 0x00000000006ac131 in Item_copy_int::copy (this=0x7fbd7b665c20) at /git/mysql-server/sql/item.cc:3766
#18 0x00000000005c14ad in copy_fields (param=param@entry=0x7fbd7b65f4b8) at /git/mysql-server/sql/sql_select.cc:15941
#19 0x00000000005c638c in end_send_group (join=0x7fbd7b65e010, join_tab=<optimized out>, end_of_records=<optimized out>) at /git/mysql-server/sql/sql_select.cc:12977
#20 0x00000000005b636b in evaluate_join_record (join=join@entry=0x7fbd7b65e010, join_tab=join_tab@entry=0x7fbd7b65fc60, error=<optimized out>) at /git/mysql-server/sql/sql_select.cc:11996
#21 0x00000000005b65aa in sub_select (join=join@entry=0x7fbd7b65e010, join_tab=join_tab@entry=0x7fbd7b65fc60, end_of_records=end_of_records@entry=false) at /git/mysql-server/sql/sql_select.cc:11849
#22 0x00000000005beaa4 in do_select (join=join@entry=0x7fbd7b65e010, fields=fields@entry=0x7fbd7b65f678, table=table@entry=0x0, procedure=0x0) at /git/mysql-server/sql/sql_select.cc:11614
#23 0x00000000005d27fd in JOIN::exec (this=this@entry=0x7fbd7b65e010) at /git/mysql-server/sql/sql_select.cc:2400
#24 0x00000000005cc82d in mysql_select (thd=thd@entry=0x7fbd803a8000, rref_pointer_array=rref_pointer_array@entry=0x7fbd803aa260, tables=0x7fbd7b6265e8, wild_num=0, fields=..., conds=<optimized out>, og_num=1, order=0x0, group=0x7fbd7b626c18, having=0x0, proc_param=0x0, select_options=select_options@entry=2147748608, result=result@entry=0x7fbd7b626ce8, unit=unit@entry=0x7fbd803a9a58, select_lex=select_lex@entry=0x7fbd803aa078) at /git/mysql-server/sql/sql_select.cc:2619
#25 0x00000000005cca25 in handle_select (thd=thd@entry=0x7fbd803a8000, lex=lex@entry=0x7fbd803a99a8, result=result@entry=0x7fbd7b626ce8, setup_tables_done_option=setup_tables_done_option@entry=0) at /git/mysql-server/sql/sql_select.cc:297
#26 0x0000000000583b27 in execute_sqlcom_select (thd=thd@entry=0x7fbd803a8000, all_tables=<optimized out>) at /git/mysql-server/sql/sql_parse.cc:4625
#27 0x00000000005899c6 in mysql_execute_command (thd=thd@entry=0x7fbd803a8000) at /git/mysql-server/sql/sql_parse.cc:2176
#28 0x0000000000590ff6 in mysql_parse (thd=thd@entry=0x7fbd803a8000, rawbuf=<optimized out>, length=82, parser_state=parser_state@entry=0x7fbe15894680) at /git/mysql-server/sql/sql_parse.cc:5780
#29 0x0000000000592843 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7fbd803a8000, packet=packet@entry=0x7fbd8039a8c1 "", packet_length=packet_length@entry=82) at /git/mysql-server/sql/sql_parse.cc:1038
#30 0x00000000005946cc in do_command (thd=0x7fbd803a8000) at /git/mysql-server/sql/sql_parse.cc:773
#31 0x000000000063c978 in do_handle_one_connection (thd_arg=thd_arg@entry=0x7fbd803a8000) at /git/mysql-server/sql/sql_connect.cc:862
#32 0x000000000063ca35 in handle_one_connection (arg=0x7fbd803a8000) at /git/mysql-server/sql/sql_connect.cc:781
#33 0x00007fbe1527edc5 in start_thread (arg=0x7fbe15895700) at pthread_create.c:308
#34 0x00007fbe1436521d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
create TABLE t1(p int key,a CHAR (20)collate latin1_swedish_ci not null,index(a,p)) ENGINE=INNODB;
INSERT INTO t1 VALUES(0,REPEAT(0,0));
alter table t1 alter column a set default 'abcdef';
create temporary table t1(a int)select 1 as a;
ALTER TABLE t1 RENAME TO t2;
SELECT(SELECT SLEEP(0.01)FROM t1 ORDER BY AVG(DISTINCT a)) as x FROM t1 GROUP BY x;
[13 May 2016 7:43] MySQL Verification Team
Hello Roel,

Thank you for the report and test case.
Observed that 5.5.49(also, 5.5.51 daily build) debug build is
affected.

Thanks,
Umesh
[13 May 2016 7:44] MySQL Verification Team
// 5.6.30/5.7.12 - release/debug not affected
[16 Dec 2019 22:29] Roy Lyseng
Posted by developer:
 
Fixed in 5.6.30