LevelDB Storage Engine MS2 (MDEV-4201)

[MDEV-4306] LevelDB (and MyISAM): Wrong result (missing rows) with range access, prefix key on a char column Created: 2013-03-20  Updated: 2013-05-27  Resolved: 2013-05-27

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Technical task Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Petrunia
Resolution: Won't Fix Votes: 0
Labels: leveldb

Issue Links:
Relates

 Description   

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (pk INT PRIMARY KEY, c CHAR(10), KEY(c(1))) ENGINE=LevelDB;
INSERT INTO t1 VALUES (40,'october'),(41,'february');
SELECT * FROM t1 WHERE c NOT IN ('l', 'f', 'w');

Actual result:

+----+---------+
| pk | c       |
+----+---------+
| 40 | october |
+----+---------+

Expected result:

+----+----------+
| pk | c        |
+----+----------+
| 41 | february |
| 40 | october  |
+----+----------+

EXPLAIN:

+----+-------------+-------+-------+---------------+------+---------+------+------+----------+-------------+
| id | select_type | table | type  | possible_keys | key  | key_len | ref  | rows | filtered | Extra       |
+----+-------------+-------+-------+---------------+------+---------+------+------+----------+-------------+
|  1 | SIMPLE      | t1    | range | c             | c    | 2       | NULL |   30 |   100.00 | Using where |
+----+-------------+-------+-------+---------------+------+---------+------+------+----------+-------------+

revision-id: psergey@askmonty.org-20130319110939-z2fi30aslmhwxslk
revno: 4611
branch-nick: mysql-5.6-leveldb



 Comments   
Comment by Sergei Petrunia [ 2013-03-22 ]

List of ranges to be scanned (it is surprising that 'w' is not in the list of endpoints, but that itself is not a bug):

"ranges": [
"NULL < c < f",
"f < c < l", — 'february' record falls here
"l < c" — 'october' record falls here
]

The following happens:
...
> ha_leveldb->index_read_map(key='F', find_flag=HA_READ_AFTER_KEY)
get an index record with rkey='F'.
We figure that rkey=key , and since flag=HA_READ_AFTER_KEY, we should step one record forward.

However, HA_READ_AFTER_KEY in the parameter refers to the whole lookup tuple, not to the prefix that's stored in the index.

Comment by Sergei Petrunia [ 2013-03-22 ]

The problem can be observed on MyISAM, too! http://bugs.mysql.com/bug.php?id=68750

Generated at Thu Feb 08 06:55:24 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.