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

Server crashed in SEL_ARG::store_min() with extended_keys=on

Details

    Description

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (pk INT, a INT, b INT, PRIMARY KEY (pk), KEY(b), KEY(b)) ENGINE=InnoDB;
      INSERT INTO t1 VALUES (1,6,0),(2,1,0),(3,5,2),(4,8,0);
      CREATE TABLE t2 (c INT) ENGINE=InnoDB;
      INSERT INTO t2 VALUES (1),(2);
      CREATE TABLE t3 (d INT) ENGINE=InnoDB;
      INSERT INTO t3 VALUES (3),(4);
      CREATE ALGORITHM = MERGE VIEW v AS SELECT pk, a, b FROM t1, t2 WHERE pk < c AND b = '0';
       
      # Only needed on 5.5
      SET optimizer_switch='extended_keys=on';
       
      SELECT * FROM v, t3 WHERE b >= d;
       
      # Cleanup
      DROP VIEW v;
      DROP TABLE t1, t2, t3;
      

      10.3 f3ff45f9

      #3  <signal handler called>
      #4  0x00005639d4bb116a in SEL_ARG::store_min (this=0x7f9b7c04afb8, length=5, min_key=0x7f9bd0372100, min_key_flag=0) at /data/src/10.3/sql/opt_range.h:413
      #5  0x00005639d4b9a5f2 in ror_scan_selectivity (info=0x7f9b7c04b5e8, scan=0x7f9b7c04b540) at /data/src/10.3/sql/opt_range.cc:6241
      #6  0x00005639d4b9aa9f in ror_intersect_add (info=0x7f9b7c04b5e8, ror_scan=0x7f9b7c04b540, is_cpk_scan=false) at /data/src/10.3/sql/opt_range.cc:6323
      #7  0x00005639d4b9b2e3 in get_best_ror_intersect (param=0x7f9bd0373400, tree=0x7f9b7c04aec0, read_time=3.8999999999999999, are_all_covering=0x7f9bd03732df) at /data/src/10.3/sql/opt_range.cc:6524
      #8  0x00005639d4b9285e in SQL_SELECT::test_quick_select (this=0x7f9b7c044850, thd=0x7f9b7c000b00, keys_to_use=..., prev_tables=4611686018427387910, limit=18446744073709551615, force_quick_range=false, ordered_output=false, remove_false_parts_of_where=false) at /data/src/10.3/sql/opt_range.cc:2610
      #9  0x00005639d4796def in make_join_select (join=0x7f9b7c01a160, select=0x7f9b7c044210, cond=0x7f9b7c041f30) at /data/src/10.3/sql/sql_select.cc:10774
      #10 0x00005639d477d982 in JOIN::optimize_stage2 (this=0x7f9b7c01a160) at /data/src/10.3/sql/sql_select.cc:2142
      #11 0x00005639d477cadd in JOIN::optimize_inner (this=0x7f9b7c01a160) at /data/src/10.3/sql/sql_select.cc:1914
      #12 0x00005639d477b03d in JOIN::optimize (this=0x7f9b7c01a160) at /data/src/10.3/sql/sql_select.cc:1451
      #13 0x00005639d4784c64 in mysql_select (thd=0x7f9b7c000b00, tables=0x7f9b7c014ef8, wild_num=1, fields=..., conds=0x7f9b7c015e20, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f9b7c01a138, unit=0x7f9b7c0049c8, select_lex=0x7f9b7c005138) at /data/src/10.3/sql/sql_select.cc:4225
      #14 0x00005639d4776c20 in handle_select (thd=0x7f9b7c000b00, lex=0x7f9b7c004900, result=0x7f9b7c01a138, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:385
      #15 0x00005639d4741617 in execute_sqlcom_select (thd=0x7f9b7c000b00, all_tables=0x7f9b7c014ef8) at /data/src/10.3/sql/sql_parse.cc:6548
      #16 0x00005639d4737f36 in mysql_execute_command (thd=0x7f9b7c000b00) at /data/src/10.3/sql/sql_parse.cc:3821
      #17 0x00005639d47455b5 in mysql_parse (thd=0x7f9b7c000b00, rawbuf=0x7f9b7c014ce8 "SELECT * FROM v, t3 WHERE b >= d", length=32, parser_state=0x7f9bd03755f0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8091
      #18 0x00005639d4732884 in dispatch_command (command=COM_QUERY, thd=0x7f9b7c000b00, packet=0x7f9b7c162261 "SELECT * FROM v, t3 WHERE b >= d", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1857
      #19 0x00005639d473126e in do_command (thd=0x7f9b7c000b00) at /data/src/10.3/sql/sql_parse.cc:1403
      #20 0x00005639d4899df5 in do_handle_one_connection (connect=0x5639d8310030) at /data/src/10.3/sql/sql_connect.cc:1402
      #21 0x00005639d4899b79 in handle_one_connection (arg=0x5639d8310030) at /data/src/10.3/sql/sql_connect.cc:1308
      #22 0x00005639d4d36617 in pfs_spawn_thread (arg=0x5639d82553f0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #23 0x00007f9bd86be494 in start_thread (arg=0x7f9bd0376700) at pthread_create.c:333
      #24 0x00007f9bd688c93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Reproducible on release, debug and ASAN builds.
      Not reproducible with MyISAM.

      Attachments

        Activity

          The failure can be reproduced with an equivalent query that does not use any view

          SELECT pk, a, b FROM t1, t2, t3 WHERE b >= d AND pk < c AND b = '0';
          

          The order of conjunct is important. The following query works fine

          SELECT pk, a, b FROM t1, t2, t3 WHERE pk < c AND b = '0' AND b >= d;
          

          igor Igor Babaev (Inactive) added a comment - The failure can be reproduced with an equivalent query that does not use any view SELECT pk, a, b FROM t1, t2, t3 WHERE b >= d AND pk < c AND b = '0' ; The order of conjunct is important. The following query works fine SELECT pk, a, b FROM t1, t2, t3 WHERE pk < c AND b = '0' AND b >= d;

          A fix for this bug was pushed into 5.5.

          igor Igor Babaev (Inactive) added a comment - A fix for this bug was pushed into 5.5.

          People

            igor Igor Babaev (Inactive)
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.