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

Assertion `tmp >= 0' failed in best_access_path with rowid_filter=ON

    XMLWordPrintable

Details

    Description

      SET optimizer_switch='rowid_filter=on';
       
      CREATE TABLE t1 (
          pk INT AUTO_INCREMENT,
          a INT,
          b VARCHAR(8),
          KEY(a),
          PRIMARY KEY(pk),
          KEY (a,pk)
      ) ENGINE=MyISAM;
       
      INSERT INTO t1 (a,b) VALUES
          (NULL,'d'),(9,'b'),(2,'x'),(5,'k'),(NULL,'d'),(3,'s'),(5,'k'),(1,'r'),
          (8,'l'),(3,'z'),(1,'c'),(1,'q'),(NULL,'x'),(NULL,'p'),(NULL,'z'),(7,'a'),
          (0,'i'),(3,'s'),(NULL,'h'),(4,'p'),(1,'i'),(4,'f'),(1,'c'),(NULL,'a'),
          (NULL,'x'),(1,'b'),(NULL,'n'),(NULL,'h'),(5,'i'),(6,'e'),(NULL,'i'),
          (7,'e'),(1,'r'),(NULL,'z'),(1,'i'),(14,'c'),(6,'u'),(3,'b'),(4,'z'),
          (2,'c'),(70,'d'),(NULL,'p'),(21,'j'),(6,'e'),(5,'c'),(13,'i'),(42,'d'),
          (80,'s'),(14,'t'),(9,'a'),(0,'2'),(0,NULL),(0,NULL),(0,NULL),(0,''),
          (0,''),(0,'1'),(0,''),(0,''),(0,''),(0,''),(0,NULL),(0,''),(0,''),(0,''),
          (0,NULL),(0,''),(0,''),(0,''),(0,''),(0,''),(0,''),(0,NULL),(0,NULL),
          (0,NULL),(0,''),(0,''),(0,''),(0,''),(0,NULL),(0,''),(0,NULL),(0,NULL),
          (0,''),(0,''),(0,''),(0,NULL),(0,''),(0,NULL),(0,''),(0,''),(0,''),(0,''),
          (0,''),(0,''),(0,''),(0,NULL),(0,''),(0,NULL),(0,'');
       
      CREATE TABLE t2 (c INT) ENGINE=MyISAM;
      INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6);
       
      SELECT * FROM t1 JOIN t2 WHERE a = c AND pk BETWEEN 4 AND 7 AND a BETWEEN 2 AND 12 AND b != 'foo';
       
      # Cleanup
      DROP TABLE t1, t2;
      

      10.4 d87b725e

      mysqld: /data/src/10.4/sql/sql_select.cc:7903: void best_access_path(JOIN*, JOIN_TAB*, table_map, const POSITION*, uint, bool, double, POSITION*, POSITION*): Assertion `tmp >= 0' failed.
      200202 20:01:32 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f505de2af12 in __GI___assert_fail (assertion=0x564f2cf10b07 "tmp >= 0", file=0x564f2cf0f988 "/data/src/10.4/sql/sql_select.cc", line=7903, function=0x564f2cf13fc0 <best_access_path(JOIN*, st_join_table*, unsigned long long, st_position const*, unsigned int, bool, double, st_position*, st_position*)::__PRETTY_FUNCTION__> "void best_access_path(JOIN*, JOIN_TAB*, table_map, const POSITION*, uint, bool, double, POSITION*, POSITION*)") at assert.c:101
      #8  0x0000564f2c25eb79 in best_access_path (join=0x7f503c016800, s=0x7f503c0178e0, remaining_tables=1, join_positions=0x7f503c018250, idx=1, disable_jbuf=false, record_count=6, pos=0x7f503c018380, loose_scan_pos=0x7f504bfb1580) at /data/src/10.4/sql/sql_select.cc:7903
      #9  0x0000564f2c262b33 in best_extension_by_limited_search (join=0x7f503c016800, remaining_tables=1, idx=1, record_count=6, read_time=3.2102539062500002, search_depth=61, prune_level=1, use_cond_selectivity=4) at /data/src/10.4/sql/sql_select.cc:9464
      #10 0x0000564f2c263283 in best_extension_by_limited_search (join=0x7f503c016800, remaining_tables=3, idx=0, record_count=1, read_time=0, search_depth=62, prune_level=1, use_cond_selectivity=4) at /data/src/10.4/sql/sql_select.cc:9550
      #11 0x0000564f2c260abf in greedy_search (join=0x7f503c016800, remaining_tables=3, search_depth=62, prune_level=1, use_cond_selectivity=4) at /data/src/10.4/sql/sql_select.cc:8668
      #12 0x0000564f2c25fd0c in choose_plan (join=0x7f503c016800, join_tables=3) at /data/src/10.4/sql/sql_select.cc:8233
      #13 0x0000564f2c25782c in make_join_statistics (join=0x7f503c016800, tables_list=..., keyuse_array=0x7f503c016af0) at /data/src/10.4/sql/sql_select.cc:5542
      #14 0x0000564f2c24b6c2 in JOIN::optimize_inner (this=0x7f503c016800) at /data/src/10.4/sql/sql_select.cc:2251
      #15 0x0000564f2c249002 in JOIN::optimize (this=0x7f503c016800) at /data/src/10.4/sql/sql_select.cc:1598
      #16 0x0000564f2c25445c in mysql_select (thd=0x7f503c000af0, tables=0x7f503c013880, wild_num=1, fields=..., conds=0x7f503c0155e0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f503c0167d8, unit=0x7f503c004a18, select_lex=0x7f503c0132c0) at /data/src/10.4/sql/sql_select.cc:4652
      #17 0x0000564f2c2440a6 in handle_select (thd=0x7f503c000af0, lex=0x7f503c004958, result=0x7f503c0167d8, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:420
      #18 0x0000564f2c20a7f7 in execute_sqlcom_select (thd=0x7f503c000af0, all_tables=0x7f503c013880) at /data/src/10.4/sql/sql_parse.cc:6360
      #19 0x0000564f2c1ffecd in mysql_execute_command (thd=0x7f503c000af0) at /data/src/10.4/sql/sql_parse.cc:3899
      #20 0x0000564f2c20e903 in mysql_parse (thd=0x7f503c000af0, rawbuf=0x7f503c013198 "SELECT * FROM t1 JOIN t2 WHERE a = c AND pk BETWEEN 4 AND 7 AND a BETWEEN 2 AND 12 AND b != 'foo'", length=97, parser_state=0x7f504bfb3160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7901
      #21 0x0000564f2c1f9ad0 in dispatch_command (command=COM_QUERY, thd=0x7f503c000af0, packet=0x7f503c0083a1 "SELECT * FROM t1 JOIN t2 WHERE a = c AND pk BETWEEN 4 AND 7 AND a BETWEEN 2 AND 12 AND b != 'foo'", packet_length=97, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
      #22 0x0000564f2c1f815d in do_command (thd=0x7f503c000af0) at /data/src/10.4/sql/sql_parse.cc:1360
      #23 0x0000564f2c381377 in do_handle_one_connection (connect=0x564f307ac630) at /data/src/10.4/sql/sql_connect.cc:1412
      #24 0x0000564f2c3810c6 in handle_one_connection (arg=0x564f307ac630) at /data/src/10.4/sql/sql_connect.cc:1316
      #25 0x0000564f2cd898c9 in pfs_spawn_thread (arg=0x564f306d04f0) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #26 0x00007f505fdb34a4 in start_thread (arg=0x7f504bfb4700) at pthread_create.c:456
      #27 0x00007f505dee7d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      EXPLAIN also crashes.
      Not reproducible with rowid_filter=off.
      No obvious problem on a non-debug build.

      Attachments

        Issue Links

          Activity

            People

              igor Igor Babaev
              elenst Elena Stepanova
              Votes:
              1 Vote for this issue
              Watchers:
              8 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.