[MDEV-16754] Assertion `0' failed in Protocol::end_statement() with join_cache_level>2 Created: 2018-07-13  Updated: 2019-02-19  Resolved: 2019-02-19

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Alice Sherepa Assignee: Alice Sherepa
Resolution: Cannot Reproduce Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-15601 [draft] protocol.cc:587: void Protoco... Closed

 Description   

--source include/have_innodb.inc
set join_cache_level=3;
 
CREATE TABLE t1 (id int, v1 varchar(1) ) ENGINE=InnoDB;
INSERT INTO t1 VALUES (10,'i'),(11,'x'),(12,'g'),(13,'q'),(14,'m'),(15,'p'),(16,'e'),(17,'t'),(18,'j'),(19,'h'),(20,'w');
 
CREATE TABLE t2 (v2 varchar(1), v1 varchar(1)) ENGINE=InnoDB ;
 
SELECT id FROM t1
WHERE (v1 IN (SELECT v2 FROM t2 WHERE v1 = v2))
HAVING id = 'a';

5.5 2fbf2277ffec86d69f793534

Thread 1 (Thread 0x7f0188623700 (LWP 20924)):
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
#1  0x0000000000d18571 in my_write_core (sig=6) at /home/alice/git/5.5/mysys/stacktrace.c:457
#2  0x00000000007d9b7e in handle_fatal_signal (sig=6) at /home/alice/git/5.5/sql/signal_handler.cc:262
#3  <signal handler called>
#4  0x00007f0186da5428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#5  0x00007f0186da702a in __GI_abort () at abort.c:89
#6  0x00007f0186d9dbd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0xd7307c "0", file=file@entry=0xd72ef8 "/home/alice/git/5.5/sql/protocol.cc", line=line@entry=521, function=function@entry=0xd737a0 <Protocol::end_statement()::__PRETTY_FUNCTION__> "void Protocol::end_statement()") at assert.c:92
#7  0x00007f0186d9dc82 in __GI___assert_fail (assertion=0xd7307c "0", file=0xd72ef8 "/home/alice/git/5.5/sql/protocol.cc", line=521, function=0xd737a0 <Protocol::end_statement()::__PRETTY_FUNCTION__> "void Protocol::end_statement()") at assert.c:101
#8  0x0000000000569d31 in Protocol::end_statement (this=0x7f018138f628) at /home/alice/git/5.5/sql/protocol.cc:521
#9  0x000000000060e8c2 in dispatch_command (command=COM_QUERY, thd=0x7f018138f060, packet=0x7f01801bb061 "SELECT id FROM t1\nWHERE (v1 IN (SELECT v2 FROM t2 WHERE v1 = v2))\nHAVING id = 'a'", packet_length=81) at /home/alice/git/5.5/sql/sql_parse.cc:1462
#10 0x000000000060c645 in do_command (thd=0x7f018138f060) at /home/alice/git/5.5/sql/sql_parse.cc:793
#11 0x00000000007222a2 in do_handle_one_connection (thd_arg=0x7f018138f060) at /home/alice/git/5.5/sql/sql_connect.cc:1268
#12 0x000000000072200b in handle_one_connection (arg=0x7f018138f060) at /home/alice/git/5.5/sql/sql_connect.cc:1184
#13 0x0000000000cc440f in pfs_spawn_thread (arg=0x7f01813b2ca0) at /home/alice/git/5.5/storage/perfschema/pfs.cc:1015
#14 0x00007f01879d06ba in start_thread (arg=0x7f0188623700) at pthread_create.c:333
#15 0x00007f0186e7741d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109



 Comments   
Comment by Alice Sherepa [ 2018-08-16 ]

Not reproducible after

commit f9b43c2565284feefe94e4feaa4c02bf25a6f921
Author: Varun Gupta <varun.gupta@mariadb.com>
Date:   Wed Jul 25 14:20:16 2018 +0530
 
    MDEV-16751: Server crashes in st_join_table::cleanup or TABLE_LIST::is_with_table_recursive_reference
                with join_cache_level>2
    
    During muliple equality propagation for a query in which we have an IN subquery, the items in the select list of the
    subquery may not be part of the multiple equality because there might be another occurence of the same field in the
    where clause of the subquery.
    So we keyuse_is_valid_for_access_in_chosen_plan function which expects the items in the select list of the subquery to
    be same to the ones in the multiple equality (through these multiple equalities we create keyuse array).
    The solution would be that we expect the same field not the same Item because when we have SEMI JOIN MATERIALIZATION SCAN,
    we use copy back technique to copies back the materialised table fields to the original fields of the base tables.

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