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

[Draft] Assertion `min_key || max_key' fails in ha_rows ha_innobase::records_in_range

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.1.67, 5.2.14
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      There was a somewhat similar upstream bug http://bugs.mysql.com/bug.php?id=66513, but it's fixed in 5.1.66, and the test case provided there doesn't cause a failure neither on MySQL nor MariaDB, while the one below fails on MariaDB 5.1 / 5.2, but doesn't fail on MySQL 5.1, or MariaDB 5.3+.

      The comment in the upstream bug says "In debug builds, an InnoDB assertion was overly aggressive about prohibiting an open range."
      It doesn't sound dangerous, so maybe it's not even worth fixing in 5.1 / 5.2, since it doesn't fail in upper versions.
      I'll file it to look into it a bit more later, to see if I can modify the test case so that it fails on MySQL and/or MariaDB 5.3+.

      #5  0x00007f118bb84b8b in __GI_abort () at abort.c:91
      #6  0x00007f118bb7a0ee in __assert_fail_base (fmt=<optimized out>, assertion=0x14a38aa "min_key || max_key", file=0x14a07f3 "handler/ha_innodb.cc", line=<optimized out>, function=<optimized out>) at assert.c:94
      #7  0x00007f118bb7a192 in __GI___assert_fail (assertion=0x14a38aa "min_key || max_key", file=0x14a07f3 "handler/ha_innodb.cc", line=7957, function=0x14a73c0 "virtual ha_rows ha_innobase::records_in_range(uint, key_range*, key_range*)") at assert.c:103
      #8  0x0000000000cb4312 in ha_innobase::records_in_range (this=0x7f112803f5e0, keynr=0, min_key=0x0, max_key=0x0) at handler/ha_innodb.cc:7957
      #9  0x00000000008f7e47 in check_quick_keys (param=0x7f11885d42f0, idx=0, key_tree=0x7f1128090898, min_key=0x7f11885d4660 "\020", min_key_flag=0, min_keypart=-1, max_key=0x7f11885d555e "", max_key_flag=0, max_keypart=-1) at opt_range.cc:7678
      #10 0x00000000008f6f10 in check_quick_select (param=0x7f11885d42f0, idx=0, tree=0x7f1128090898, update_tbl_stats=true) at opt_range.cc:7453
      #11 0x00000000008eafb9 in get_key_scans_params (param=0x7f11885d42f0, tree=0x7f1128090398, index_read_must_be_used=false, update_tbl_stats=true, read_time=3.3000000000000003) at opt_range.cc:4853
      #12 0x00000000008e2af0 in SQL_SELECT::test_quick_select (this=0x7f112808b508, thd=0x4883d48, keys_to_use=..., prev_tables=0, limit=18446744073709551615, force_quick_range=false) at opt_range.cc:2396
      #13 0x00000000007d07c5 in get_quick_record_count (thd=0x4883d48, select=0x7f112808b508, table=0x7f112802bbb8, keys=0x7f112808af80, limit=18446744073709551615) at sql_select.cc:2625
      #14 0x00000000007d2b7b in make_join_statistics (join=0x7f11280883e0, tables_arg=0x7f1128001560, conds=0x7f1128087cf8, keyuse_array=0x7f11280899a8) at sql_select.cc:3069
      #15 0x00000000007c6fe5 in JOIN::optimize (this=0x7f11280883e0) at sql_select.cc:1036
      #16 0x00000000007d0278 in mysql_select (thd=0x4883d48, rref_pointer_array=0x48867e8, tables=0x7f1128001560, wild_num=0, fields=..., conds=0x7f1128038d50, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=3489974912, result=0x7f1128087b38, unit=0x48861c0, select_lex=0x4886610) at sql_select.cc:2563
      #17 0x000000000070b075 in mysql_execute_command (thd=0x4883d48) at sql_parse.cc:3495
      #18 0x0000000000718d46 in mysql_parse (thd=0x4883d48, rawbuf=0x7f1128000ac0 "DELETE    test1.A , test.B FROM test1 .   /* table1_innodb_int  table10_int_autoinc  t1_temp_myisam_13085 */ table0_innodb_int_autoinc  AS A NATURAL JOIN test .   /* table0_innodb_int  table10_int_aut"..., length=331, found_semicolon=0x7f11885d7890) at sql_parse.cc:6216
      #19 0x00000000007010d9 in dispatch_command (command=COM_QUERY, thd=0x4883d48, packet=0x48fa3d9 "DELETE    test1.A , test.B FROM test1 .   /* table1_innodb_int  table10_int_autoinc  t1_temp_myisam_13085 */ table0_innodb_int_autoinc  AS A NATURAL JOIN test .   /* table0_innodb_int  table10_int_aut"..., packet_length=331) at sql_parse.cc:1248
      #20 0x00000000006ffa9e in do_command (thd=0x4883d48) at sql_parse.cc:920
      #21 0x00000000006fa205 in handle_one_connection (arg=0x4883d48) at sql_connect.cc:1226
      #22 0x00007f118c715e9a in start_thread (arg=0x7f11885d8700) at pthread_create.c:308
      #23 0x00007f118bc3ecbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
      

      bzr version-info

      revision-id: neeraj.x.bisht@oracle.com-20130420065822-jb0ds0pvpucxdqiy
      revno: 3997
      branch-nick: mysql-5.1
      

      Draft test case:

      
      --disable_abort_on_error
      --source include/have_innodb.inc
      	CREATE TABLE `table10_innodb_int` (
       `col_tinyint` tinyint,
       `col_timestamp` timestamp NULL DEFAULT 0,
       `col_varchar_257_latin1` varchar(257)  CHARACTER SET latin1,
       `col_varchar_257_binary` varchar(257)  CHARACTER SET binary,
       `col_varchar_257_utf8` varchar(257)  CHARACTER SET utf8,
       `col_bigint` bigint,
       `col_bigint_unsigned` bigint unsigned,
       pk int,
       `col_tinyint_unsigned` tinyint unsigned,
       /*Indices*/
       primary key (pk)) ENGINE=innodb;
      	CREATE SCHEMA /*!IF NOT EXISTS*/ test1;
      	USE test1;
      	CREATE TABLE `table0_innodb_int_autoinc` (
       `col_tinyint` tinyint,
       `col_bigint` bigint,
       `col_tinyint_unsigned` tinyint unsigned,
       `col_varchar_257_utf8` varchar(257)  CHARACTER SET utf8,
       `col_varchar_257_binary` varchar(257)  CHARACTER SET binary,
       `col_varchar_257_latin1` varchar(257)  CHARACTER SET latin1,
       `col_bigint_unsigned` bigint unsigned,
       pk int auto_increment,
       `col_timestamp` timestamp NULL DEFAULT 0,
       /*Indices*/
       primary key (pk)) ENGINE=innodb;
      	CREATE TABLE `table1_innodb_int_autoinc` (
       `col_varchar_257_latin1` varchar(257)  CHARACTER SET latin1,
       `col_varchar_257_binary` varchar(257)  CHARACTER SET binary,
       `col_bigint_unsigned` bigint unsigned,
       `col_varchar_257_utf8` varchar(257)  CHARACTER SET utf8,
       `col_bigint` bigint,
       `col_tinyint_unsigned` tinyint unsigned,
       `col_tinyint` tinyint,
       pk int auto_increment,
       `col_timestamp` timestamp NULL DEFAULT 0,
       /*Indices*/
       primary key (pk)) ENGINE=innodb;
      	INSERT /*! IGNORE */ INTO table1_innodb_int_autoinc VALUES  ('z', 'e', 312718699125538816, NULL, -5957980832034455552, NULL, 0, NULL, NULL);
      	DELETE    test1.A , test.B FROM test1 .   /* table1_innodb_int  table10_int_autoinc  t1_temp_myisam_13085 */ table0_innodb_int_autoinc  AS A NATURAL JOIN test .   /* table0_innodb_int  table10_int_autoinc  table1_myisam_int */ table10_innodb_int  B WHERE col_tinyint BETWEEN 50 AND 50 + 2  AND ( `pk` IS NULL OR `pk` <> VERSION() );
      

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                elenst Elena Stepanova
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: