Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Clone in Desktop Download ZIP

Loading…

index_read_map(HA_READ_BEFORE_KEY) does not work in reverse column family #46

Closed
spetrunia opened this Issue · 1 comment

1 participant

@spetrunia
Collaborator

This is a continuation of issue #16.

Let's work with the same dataset

create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int);
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;

create table t2 (
  pk int not null,
  a  int not null,
  b  int not null,
  primary key(pk),
  key(a) comment 'rev:cf1'
) engine=rocksdb;
insert into t2 select A.a, FLOOR(A.a/10), A.a from t1 A;

Try this:

MySQL [test]> select max(a) from t2 where a < 2;
+--------+
| max(a) |
+--------+
|      2 |
+--------+

This is apparently wrong. For comparison, the same without the index:

MySQL [test]> create table t3 as select * from t2;
Query OK, 1000 rows affected (0.58 sec)
Records: 1000  Duplicates: 0  Warnings: 0

MySQL [test]> select max(a) from t3 where a < 2;
+--------+
| max(a) |
+--------+
|      1 |
+--------+
@spetrunia spetrunia added the bug label
@spetrunia spetrunia self-assigned this
@spetrunia spetrunia added this to the high-pri milestone
@spetrunia spetrunia referenced this issue from a commit
@spetrunia spetrunia Fix issue #46: index_read_map(HA_READ_BEFORE_KEY) does not work in re…
…verse CF

Summary:
Make ha_rocksdb::index_read_map() correctly handle
find_flag=HA_READ_BEFORE_KEY.
Explanation how it should be handled is provided in
storage/rocksdb/rocksdb-range-access.txt

Test Plan: mtr t/rocksdb_range.test, used gcov to check the new code is covered

Reviewers: maykov, hermanlee4, jtolmer, yoshinorim

Differential Revision: https://reviews.facebook.net/D35331
270780c
@spetrunia spetrunia closed this
@spetrunia spetrunia referenced this issue from a commit
@spetrunia spetrunia Fix issue #46: index_read_map(HA_READ_BEFORE_KEY) does not work in re…
…verse CF

Summary:
Make ha_rocksdb::index_read_map() correctly handle
find_flag=HA_READ_BEFORE_KEY.
Explanation how it should be handled is provided in
storage/rocksdb/rocksdb-range-access.txt

Test Plan: mtr t/rocksdb_range.test, used gcov to check the new code is covered

Reviewers: maykov, hermanlee4, jtolmer, yoshinorim

Differential Revision: https://reviews.facebook.net/D35331
61906d3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.