Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL)
-
None
Description
Found this while working on MDEV-14433:
Found an interesting mismatch between query plans that depends on the index number:
Upstream, MySQL 5.6
CREATE TABLE t3(
|
pk int primary key,
|
a varchar(10) NOT NULL,
|
e int(11) DEFAULT 0,
|
KEY (a)
|
) ENGINE=ROCKSDB DEFAULT CHARSET=utf8;
|
insert into t3 values (1,1,1),(2,2,2);
|
explain select a from t3 where a <'zzz';
|
+----+-------------+-------+-------+---------------+------+---------+------+------+-------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+----+-------------+-------+-------+---------------+------+---------+------+------+-------------+
|
| 1 | SIMPLE | t3 | range | a | a | 32 | NULL | 2 | Using where |
|
+----+-------------+-------+-------+---------------+------+---------+------+------+-------------+
|
CREATE TABLE t4(
|
pk int,
|
a varchar(10) NOT NULL,
|
e int(11) DEFAULT 0,
|
KEY (a)
|
) ENGINE=ROCKSDB DEFAULT CHARSET=utf8;
|
insert into t4 values (1,1,1),(2,2,2);
|
explain select a from t4 where a <'zzz';
|
+----+-------------+-------+-------+---------------+------+---------+------+------+-------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+----+-------------+-------+-------+---------------+------+---------+------+------+-------------+
|
| 1 | SIMPLE | t4 | range | a | a | 32 | NULL | 1 | Using where |
|
+----+-------------+-------+-------+---------------+------+---------+------+------+-------------+
|
MariaDB:
CREATE TABLE t3(
|
pk int primary key,
|
a varchar(10) NOT NULL,
|
e int(11) DEFAULT 0,
|
KEY (a)
|
) ENGINE=ROCKSDB DEFAULT CHARSET=utf8;
|
insert into t3 values (1,1,1),(2,2,2);
|
explain select a from t3 where a <'zzz';
|
+------+-------------+-------+-------+---------------+------+---------+------+------+-------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+------+-------------+-------+-------+---------------+------+---------+------+------+-------------+
|
| 1 | SIMPLE | t3 | range | a | a | 32 | NULL | 1 | Using where |
|
+------+-------------+-------+-------+---------------+------+---------+------+------+-------------+
|
CREATE TABLE t4(
|
pk int,
|
a varchar(10) NOT NULL,
|
e int(11) DEFAULT 0,
|
KEY (a)
|
) ENGINE=ROCKSDB DEFAULT CHARSET=utf8;
|
insert into t4 values (1,1,1),(2,2,2);
|
explain select a from t4 where a <'zzz';
|
+------+-------------+-------+-------+---------------+------+---------+------+------+--------------------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+------+-------------+-------+-------+---------------+------+---------+------+------+--------------------------+
|
| 1 | SIMPLE | t4 | index | a | a | 32 | NULL | 0 | Using where; Using index |
|
+------+-------------+-------+-------+---------------+------+---------+------+------+--------------------------+
|
Attachments
Issue Links
- includes
-
MDEV-14607 storage_engine-rocksdb.type_bit_indexes fails after latest pushes
-
- Closed
-
- is part of
-
MDEV-14433 RocksDB may show empty or incorrect output with rocksdb_strict_collation_check=off
-
- Closed
-
Debugging
CREATE TABLE t4(
pk int,
a varchar(10) NOT NULL,
e int(11) DEFAULT 0,
KEY (a)
) ENGINE=ROCKSDB DEFAULT CHARSET=utf8;
in TABLE_SHARE::init_from_binary_frm_image, stepping into the
if (handler_file->index_flags(key, i, 0) & HA_KEYREAD_ONLY)
call:
myrocks::ha_rocksdb::index_flags (this=0x7fff6c01b7e8, inx=0, part=0, all_parts=false)
There, we have
(gdb) p table
$33 = (TABLE *) 0x0
(gdb) p table_share
$34 = (TABLE_SHARE *) 0x7ffff41bd890
(gdb) p table_share->primary_key
$35 = 0
That is,
if (inx == table_share->primary_key) {
and returns an incorrect value.