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

Assertion `tab->select->quick' failed in test_if_skip_sort_order

Details

    Description

      CREATE TABLE lineitem (l_orderkey int, l_linenumber int, l_quantity double, PRIMARY KEY (l_orderkey,l_linenumber), KEY (l_orderkey), KEY (l_orderkey,l_quantity));
      INSERT INTO lineitem VALUES (290,1,35),(290,2,2);
      SELECT * FROM lineitem WHERE l_quantity = 31 AND (l_quantity = 50 OR l_orderkey = 41) ORDER BY l_orderkey, l_linenumber;
       
      # Cleanup
      DROP TABLE lineitem;
      

      10.6 ec2574fd

      mariadbd: /data/src/10.6/sql/sql_select.cc:24760: bool test_if_skip_sort_order(JOIN_TAB*, ORDER*, ha_rows, bool, const key_map*, bool*): Assertion `tab->select->quick' failed.
      231027 17:58:50 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007f3533853e32 in __GI___assert_fail (assertion=0x56544b582ac0 "tab->select->quick", file=0x56544b575c00 "/data/src/10.6/sql/sql_select.cc", line=24760, function=0x56544b582a40 "bool test_if_skip_sort_order(JOIN_TAB*, ORDER*, ha_rows, bool, const key_map*, bool*)") at ./assert/assert.c:101
      #10 0x000056544966ca5e in test_if_skip_sort_order (tab=0x629000271238, order=0x62b0000878f0, select_limit=18446744073709551615, no_changes=false, map=0x61900009a230, fatal_error=0x7f352c0050e0) at /data/src/10.6/sql/sql_select.cc:24760
      #11 0x00005654495cd584 in JOIN::optimize_stage2 (this=0x62b000087c38) at /data/src/10.6/sql/sql_select.cc:3286
      #12 0x00005654495c5ca7 in JOIN::optimize_inner (this=0x62b000087c38) at /data/src/10.6/sql/sql_select.cc:2563
      #13 0x00005654495be881 in JOIN::optimize (this=0x62b000087c38) at /data/src/10.6/sql/sql_select.cc:1870
      #14 0x00005654495e0720 in mysql_select (thd=0x62b00007e218, tables=0x62b0000859f0, fields=..., conds=0x62b000086e20, og_num=2, order=0x62b0000878f0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x62b000087c08, unit=0x62b0000825e0, select_lex=0x62b000085390) at /data/src/10.6/sql/sql_select.cc:5100
      #15 0x00005654495affa4 in handle_select (thd=0x62b00007e218, lex=0x62b000082518, result=0x62b000087c08, setup_tables_done_option=0) at /data/src/10.6/sql/sql_select.cc:561
      #16 0x00005654495145ed in execute_sqlcom_select (thd=0x62b00007e218, all_tables=0x62b0000859f0) at /data/src/10.6/sql/sql_parse.cc:6285
      #17 0x0000565449502d22 in mysql_execute_command (thd=0x62b00007e218, is_called_from_prepared_stmt=false) at /data/src/10.6/sql/sql_parse.cc:3961
      #18 0x000056544951f5dd in mysql_parse (thd=0x62b00007e218, rawbuf=0x62b000085238 "SELECT * FROM lineitem WHERE l_quantity = 31 AND (l_quantity = 50 OR l_orderkey = 41) ORDER BY l_orderkey, l_linenumber", length=119, parser_state=0x7f352c0069f0) at /data/src/10.6/sql/sql_parse.cc:8050
      #19 0x00005654494f5270 in dispatch_command (command=COM_QUERY, thd=0x62b00007e218, packet=0x62900025d219 "SELECT * FROM lineitem WHERE l_quantity = 31 AND (l_quantity = 50 OR l_orderkey = 41) ORDER BY l_orderkey, l_linenumber", packet_length=119, blocking=true) at /data/src/10.6/sql/sql_parse.cc:1896
      #20 0x00005654494f1fa4 in do_command (thd=0x62b00007e218, blocking=true) at /data/src/10.6/sql/sql_parse.cc:1409
      #21 0x0000565449963086 in do_handle_one_connection (connect=0x608000002db8, put_in_cache=true) at /data/src/10.6/sql/sql_connect.cc:1416
      #22 0x0000565449962a47 in handle_one_connection (arg=0x608000002d38) at /data/src/10.6/sql/sql_connect.cc:1318
      #23 0x000056544a5c62aa in pfs_spawn_thread (arg=0x617000005b98) at /data/src/10.6/storage/perfschema/pfs.cc:2201
      #24 0x00007f35338a8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #25 0x00007f353392861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Reproducible with MyISAM and Aria. Not reproducible with InnoDB.

      The failure started happening after this commit in 10.6:

      commit ec2574fd8fd46da765fd60b0ca9650b729073401
      Author:     Rex
      AuthorDate: Fri Sep 15 08:44:49 2023 +1100
      Commit:     Sergei Petrunia
      CommitDate: Wed Oct 25 17:21:37 2023 +0300
       
          MDEV-31983 jointable materialization subquery optimization ignoring
      

      Attachments

        Activity

          Johnston Rex Johnston added a comment -

          looks like we all missed something, trivial fixup.

          Johnston Rex Johnston added a comment - looks like we all missed something, trivial fixup.

          Hi Johnston,

          Yes.
          Please rename the table in the test from lineitem to t1 and then it's ok to push.

          psergei Sergei Petrunia added a comment - Hi Johnston , Yes. Please rename the table in the test from lineitem to t1 and then it's ok to push.
          Johnston Rex Johnston added a comment - pushed in https://github.com/MariaDB/server/commit/ab6139ddc09b28df94016ac1e7345d623b08de8e

          People

            Johnston Rex Johnston
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.