Bug #80759 Assertion `table_ref->has_record in join_read_key(JOIN_TAB*)
Submitted: 16 Mar 2016 8:27 Modified: 16 Mar 2016 10:22
Reporter: Ramesh Sivaraman (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S6 (Debug Builds)
Version:5.6.29, 5.7.11, 5.5.48 OS:CentOS
Assigned to: CPU Architecture:Any
Tags: debug

[16 Mar 2016 8:27] Ramesh Sivaraman
Description:
Error info

2016-03-16 03:28:47 10279 [Note] Event Scheduler: scheduler thread started with id 1
mysqld: /sda/workdir/mysql-server/sql/sql_executor.cc:2064: int join_read_key(JOIN_TAB*): Assertion `table_ref->has_record' failed.
07:28:48 UTC - mysqld got signal 6 ;

GDB info

#0  0x00007fb49cade741 in pthread_kill () from /lib64/libpthread.so.0
#1  0x0000000000a96d62 in my_write_core (sig=6) at /sda/workdir/mysql-server/mysys/stacktrace.c:422
#2  0x0000000000727f64 in handle_fatal_signal (sig=6) at /sda/workdir/mysql-server/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x00007fb49b6dd5f7 in raise () from /lib64/libc.so.6
#5  0x00007fb49b6dece8 in abort () from /lib64/libc.so.6
#6  0x00007fb49b6d6566 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007fb49b6d6612 in __assert_fail () from /lib64/libc.so.6
#8  0x00000000007a6c8c in join_read_key (tab=0x7fb468d51958) at /sda/workdir/mysql-server/sql/sql_executor.cc:2064
#9  0x00000000007a50be in sub_select (join=0x7fb468c20988, join_tab=0x7fb468d51958, end_of_records=false) at /sda/workdir/mysql-server/sql/sql_executor.cc:1259
#10 0x00000000007a5bda in evaluate_join_record (join=0x7fb468c20988, join_tab=0x7fb468d51658) at /sda/workdir/mysql-server/sql/sql_executor.cc:1604
#11 0x00000000007a51db in sub_select (join=0x7fb468c20988, join_tab=0x7fb468d51658, end_of_records=false) at /sda/workdir/mysql-server/sql/sql_executor.cc:1279
#12 0x00000000007a4abe in do_select (join=0x7fb468c20988) at /sda/workdir/mysql-server/sql/sql_executor.cc:936
#13 0x00000000007a2a5d in JOIN::exec (this=0x7fb468c20988) at /sda/workdir/mysql-server/sql/sql_executor.cc:194
#14 0x0000000000802d07 in mysql_execute_select (thd=0x7fb474f07000, select_lex=0x7fb474f094d0, free_join=true) at /sda/workdir/mysql-server/sql/sql_select.cc:1101
#15 0x0000000000802ff9 in mysql_select (thd=0x7fb474f07000, tables=0x7fb468c1f250, wild_num=1, fields=..., conds=0x7fb468c20788, order=0x7fb474f09698, group=0x7fb474f095d0, having=0x0, select_options=2147748608, result=0x7fb468c20960, unit=0x7fb474f08e88, select_lex=0x7fb474f094d0) at /sda/workdir/mysql-server/sql/sql_select.cc:1222
#16 0x00000000008010df in handle_select (thd=0x7fb474f07000, result=0x7fb468c20960, setup_tables_done_option=0) at /sda/workdir/mysql-server/sql/sql_select.cc:110
#17 0x00000000007db19a in execute_sqlcom_select (thd=0x7fb474f07000, all_tables=0x7fb468c1f250) at /sda/workdir/mysql-server/sql/sql_parse.cc:5133
#18 0x00000000007d3f8f in mysql_execute_command (thd=0x7fb474f07000) at /sda/workdir/mysql-server/sql/sql_parse.cc:2655
#19 0x00000000007ddd20 in mysql_parse (thd=0x7fb474f07000, rawbuf=0x7fb468c1f010 "select * from t2,t1 where t1.a=t2.a and(b=7 or b is null)", length=57, parser_state=0x7fb49d09a6a0) at /sda/workdir/mysql-server/sql/sql_parse.cc:6385
#20 0x00000000007d0f09 in dispatch_command (command=COM_QUERY, thd=0x7fb474f07000, packet=0x7fb46f6ac001 "", packet_length=57) at /sda/workdir/mysql-server/sql/sql_parse.cc:1339
#21 0x00000000007cff5c in do_command (thd=0x7fb474f07000) at /sda/workdir/mysql-server/sql/sql_parse.cc:1036
#22 0x00000000007978ed in do_handle_one_connection (thd_arg=0x7fb474f07000) at /sda/workdir/mysql-server/sql/sql_connect.cc:982
#23 0x00000000007973d6 in handle_one_connection (arg=0x7fb474f07000) at /sda/workdir/mysql-server/sql/sql_connect.cc:898
#24 0x0000000000b455e9 in pfs_spawn_thread (arg=0x7fb480b47600) at /sda/workdir/mysql-server/storage/perfschema/pfs.cc:1860
#25 0x00007fb49cad9dc5 in start_thread () from /lib64/libpthread.so.0
#26 0x00007fb49b79e21d in clone () from /lib64/libc.so.6

How to repeat:
Testcase

DROP DATABASE test;CREATE DATABASE test;USE test;
CREATE TABLE t1(a INT)ENGINE=InnoDB;
SET @@session.storage_engine='archive';
create table t2(a int key auto_increment,b int);
insert into t2 values(3,0),(4,0),(5,0),(6,0);
insert INTO t1 values(5),(6);
insert into t2(a)values (1001);
INSERT INTO t1 VALUES(CONVERT(_ucs2 0x06450646 USING utf8));
INSERT INTO t1 VALUES(CONVERT(_ucs2 0x063106270633 USING utf8));
select * from t2,t1 where t1.a=t2.a and(b=7 or b is null);
[16 Mar 2016 10:22] Umesh Shastry
Hello Ramesh,

Thank you for the report and test case.
Observed that 5.6.29, 5.7.11 debug builds are affected.

Thanks,
Umesh