Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-31237

Assertion `!(tab->select && tab->select->quick)' failed in make_join_readinfo

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 11.0(EOL)
    • 11.0.2
    • Optimizer
    • None

    Description

      --source include/have_innodb.inc
       
      CREATE TABLE lineitem (l_orderkey int, l_linenumber int, l_receiptDATE date DEFAULT NULL, PRIMARY KEY (l_orderkey,l_linenumber), KEY i_l_receiptdate (l_receiptDATE), KEY i_l_orderkey (l_orderkey)) ENGINE=InnoDB;
       
      INSERT INTO lineitem VALUES (291,1,'1994-06-23'),(291,2,'1994-06-19'),
             (291,3,'1994-03-24'),(292,1,'1992-03-18'),(292,2,'1992-04-20');
       
      SELECT DISTINCT l_orderkey FROM lineitem FORCE KEY (i_l_orderkey, i_l_receiptdate) WHERE l_orderkey > 1 ORDER BY l_receiptdate;
       
      # Cleanup
      DROP TABLE lineitem;
      

      11.0 8d26537f

      mariadbd: /data/src/11.0/sql/sql_select.cc:15184: bool make_join_readinfo(JOIN*, ulonglong, uint): Assertion `!(tab->select && tab->select->quick)' failed.
      230510 20:23:45 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007fcb75653df2 in __GI___assert_fail (assertion=0x557f48cf1ca0 "!(tab->select && tab->select->quick)", file=0x557f48ce8ae0 "/data/src/11.0/sql/sql_select.cc", line=15184, function=0x557f48cf1c40 "bool make_join_readinfo(JOIN*, ulonglong, uint)") at ./assert/assert.c:101
      #10 0x0000557f46d99400 in make_join_readinfo (join=0x6290000fc188, options=0, no_jbuf_after=1) at /data/src/11.0/sql/sql_select.cc:15184
      #11 0x0000557f46d3ed5d in JOIN::optimize_stage2 (this=0x6290000fc188) at /data/src/11.0/sql/sql_select.cc:3148
      #12 0x0000557f46d39065 in JOIN::optimize_inner (this=0x6290000fc188) at /data/src/11.0/sql/sql_select.cc:2603
      #13 0x0000557f46d31db9 in JOIN::optimize (this=0x6290000fc188) at /data/src/11.0/sql/sql_select.cc:1905
      #14 0x0000557f46d53a25 in mysql_select (thd=0x62b00017a218, tables=0x6290000faae0, fields=..., conds=0x6290000fb400, og_num=1, order=0x6290000fbfe0, group=0x0, having=0x0, proc_param=0x0, select_options=2164525825, result=0x6290000fc158, unit=0x62b00017e660, select_lex=0x6290000fa3a0) at /data/src/11.0/sql/sql_select.cc:5144
      #15 0x0000557f46d2365a in handle_select (thd=0x62b00017a218, lex=0x62b00017e588, result=0x6290000fc158, setup_tables_done_option=0) at /data/src/11.0/sql/sql_select.cc:616
      #16 0x0000557f46c48a4e in execute_sqlcom_select (thd=0x62b00017a218, all_tables=0x6290000faae0) at /data/src/11.0/sql/sql_parse.cc:6279
      #17 0x0000557f46c36e75 in mysql_execute_command (thd=0x62b00017a218, is_called_from_prepared_stmt=false) at /data/src/11.0/sql/sql_parse.cc:3949
      #18 0x0000557f46c534fe in mysql_parse (thd=0x62b00017a218, rawbuf=0x6290000fa238 "SELECT DISTINCT l_orderkey FROM lineitem FORCE KEY (i_l_orderkey, i_l_receiptdate) WHERE l_orderkey > 1 ORDER BY l_receiptdate", length=126, parser_state=0x7fcb65e2da20) at /data/src/11.0/sql/sql_parse.cc:8014
      #19 0x0000557f46c293ea in dispatch_command (command=COM_QUERY, thd=0x62b00017a218, packet=0x629000285219 "SELECT DISTINCT l_orderkey FROM lineitem FORCE KEY (i_l_orderkey, i_l_receiptdate) WHERE l_orderkey > 1 ORDER BY l_receiptdate", packet_length=126, blocking=true) at /data/src/11.0/sql/sql_parse.cc:1894
      #20 0x0000557f46c2610d in do_command (thd=0x62b00017a218, blocking=true) at /data/src/11.0/sql/sql_parse.cc:1407
      #21 0x0000557f470ecaa2 in do_handle_one_connection (connect=0x608000003938, put_in_cache=true) at /data/src/11.0/sql/sql_connect.cc:1416
      #22 0x0000557f470ec463 in handle_one_connection (arg=0x6080000038b8) at /data/src/11.0/sql/sql_connect.cc:1318
      #23 0x0000557f47ce0bb6 in pfs_spawn_thread (arg=0x617000008218) at /data/src/11.0/storage/perfschema/pfs.cc:2201
      #24 0x00007fcb756a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #25 0x00007fcb757285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Not reproducible on 10.x.
      No obvious immediate problem on a non-debug build. EXPLAIN from the non-debug build, assuming it's the same (on a debug build EXPLAIN also fails):

      EXPLAIN EXTENDED SELECT DISTINCT l_orderkey FROM lineitem FORCE KEY (i_l_orderkey, i_l_receiptdate) WHERE l_orderkey > 1 ORDER BY l_receiptdate;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	SIMPLE	lineitem	index	i_l_orderkey	i_l_receiptdatei_l_orderkey	44	NULL	5	100.00	Using where; Using index; Using temporary; Using filesort
      Warnings:
      Note	1003	select distinct `test`.`lineitem`.`l_orderkey` AS `l_orderkey` from `test`.`lineitem` FORCE INDEX (`i_l_receiptdate`) FORCE INDEX (`i_l_orderkey`) where `test`.`lineitem`.`l_orderkey` > 1 order by `test`.`lineitem`.`l_receiptDATE`
      

      Not reproducible on this test case with MyISAM or Aria, the plan is different there.

      The failure started happening after the selectivity merge into 11.0

      commit 10a974adc9b250431cac44555c7aa9354e5840df (HEAD)
      Merge: f74bb51b30d e8c7222ba3a
      Author: Sergei Petrunia
      Date:   Wed Feb 15 12:03:12 2023 +0300
       
          Merge 11.0-selectivity into 11.0
      

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.