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

Assertion `ordered_index_usage == ordered_index_order_by' failed in JOIN::optimize_distinct

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5(EOL), 10.6, 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.11
    • 10.6, 10.11
    • None

    Description

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (i1 int , pk int NOT NULL PRIMARY KEY, KEY i1 (i1)) engine=innodb;
      INSERT INTO t1 VALUES (100,1),(100,2),(100,3),(100,4),(100,5),(100,6),(100,7),(100,8),(100,9),(100,10);
       
      SELECT DISTINCT i1 FROM t1 WHERE i1>"" ORDER BY pk LIMIT 5;
      

      10.2 0a891ad6a6ba698484ba

      #6  0x00007f61e4c93bd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x5556cbfe4f30 "ordered_index_usage == ordered_index_order_by", file=file@entry=0x5556cbfe48c8 "/10.2/sql/sql_select.cc", line=line@entry=3056, function=function@entry=0x5556cbfe74c0 <JOIN::optimize_distinct()::__PRETTY_FUNCTION__> "void JOIN::optimize_distinct()") at assert.c:92
      #7  0x00007f61e4c93c82 in __GI___assert_fail (assertion=0x5556cbfe4f30 "ordered_index_usage == ordered_index_order_by", file=0x5556cbfe48c8 "/10.2/sql/sql_select.cc", line=3056, function=0x5556cbfe74c0 <JOIN::optimize_distinct()::__PRETTY_FUNCTION__> "void JOIN::optimize_distinct()") at assert.c:101
      #8  0x00005556cb541811 in JOIN::optimize_distinct (this=0x7f618c0131f0) at /10.2/sql/sql_select.cc:3056
      #9  0x00005556cb53fa03 in JOIN::make_aggr_tables_info (this=0x7f618c0131f0) at /10.2/sql/sql_select.cc:2574
      #10 0x00005556cb53e577 in JOIN::optimize_inner (this=0x7f618c0131f0) at /10.2/sql/sql_select.cc:2237
      #11 0x00005556cb53a671 in JOIN::optimize (this=0x7f618c0131f0) at /10.2/sql/sql_select.cc:1113
      #12 0x00005556cb543b98 in mysql_select (thd=0x7f618c000af0, tables=0x7f618c012688, wild_num=0, fields=..., conds=0x7f618c012e50, og_num=1, order=0x7f618c0130b8, group=0x0, having=0x0, proc_param=0x0, select_options=2147748609, result=0x7f618c0131d0, unit=0x7f618c0046e8, select_lex=0x7f618c004e28) at /10.2/sql/sql_select.cc:3810
      #13 0x00005556cb537e1e in handle_select (thd=0x7f618c000af0, lex=0x7f618c004628, result=0x7f618c0131d0, setup_tables_done_option=0) at /10.2/sql/sql_select.cc:373
      #14 0x00005556cb503347 in execute_sqlcom_select (thd=0x7f618c000af0, all_tables=0x7f618c012688) at /10.2/sql/sql_parse.cc:6225
      #15 0x00005556cb4f9d5a in mysql_execute_command (thd=0x7f618c000af0) at /10.2/sql/sql_parse.cc:3532
      #16 0x00005556cb5071c1 in mysql_parse (thd=0x7f618c000af0, rawbuf=0x7f618c012448 "SELECT DISTINCT i1 FROM t1 WHERE i1>\"\" ORDER BY pk LIMIT 5", length=58, parser_state=0x7f61dc30e080, is_com_multi=false, is_next_command=false) at /10.2/sql/sql_parse.cc:7740
      #17 0x00005556cb4f54be in dispatch_command (command=COM_QUERY, thd=0x7f618c000af0, packet=0x7f618c0963f1 "SELECT DISTINCT i1 FROM t1 WHERE i1>\"\" ORDER BY pk LIMIT 5", packet_length=58, is_com_multi=false, is_next_command=false) at /10.2/sql/sql_parse.cc:1831
      #18 0x00005556cb4f3dd2 in do_command (thd=0x7f618c000af0) at /10.2/sql/sql_parse.cc:1385
      #19 0x00005556cb649db7 in do_handle_one_connection (connect=0x5556ced40090) at /10.2/sql/sql_connect.cc:1336
      #20 0x00005556cb649b22 in handle_one_connection (arg=0x5556ced40090) at /10.2/sql/sql_connect.cc:1241
      #21 0x00005556cbe62d9e in pfs_spawn_thread (arg=0x5556ced4ae80) at /10.2/storage/perfschema/pfs.cc:1869
      #22 0x00007f61e58d86ba in start_thread (arg=0x7f61dc30f700) at pthread_create.c:333
      #23 0x00007f61e4d6d41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
      

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            alice Alice Sherepa
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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