MySQLOnRocksDB/mysql-5.6
forked from facebook/mysql-5.6

Loading…
Point lookup by reverse column family doesn't work #16
Closed
yoshinorim opened this Issue
· 4 comments
Owner
yoshinorim
commented
Collaborator
spetrunia
commented
Collaborator
spetrunia
commented
Agreed to split the patch into smaller pieces, this is the first one: https://reviews.facebook.net/D33975
This was referenced
Collaborator
spetrunia
commented
A patch to mark HA_READ_KEY_OR_PREV as unsupported: https://reviews.facebook.net/D35337
Collaborator
spetrunia
commented
Fixed reverse CF handling for all kinds of index lookups.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to repeat:
CREATE TABLE
linktable(id1bigint(20) unsigned NOT NULL DEFAULT '0',id2bigint(20) unsigned NOT NULL DEFAULT '0',link_typebigint(20) unsigned NOT NULL DEFAULT '0',visibilitytinyint(3) NOT NULL DEFAULT '0',datavarchar(255) COLLATE latin1_bin NOT NULL DEFAULT '',timebigint(20) unsigned NOT NULL DEFAULT '0',versionint(11) unsigned NOT NULL DEFAULT '0',PRIMARY KEY (
link_type,id1,id2) COMMENT 'rev:cf_primary',KEY
id1_type(id1,link_type,visibility,time,id2,version,data)) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
insert into linktable values (1,1,1,1,1,1,1),(2,2,2,2,2,2,2),(3,3,3,3,3,3,3),(4,4,4,4,4,4,4),(5,5,5,5,5,5,5),(6,6,6,6,6,6,6),(7,7,7,7,7,7,7),(8,8,8,8,8,8,8),(9,9,9,9,9,9,9),(10,10,10,10,10,10,10),(11,11,11,11,11,11,11),(12,12,12,12,12,12,12),(13,13,13,13,13,13,13),(14,14,14,14,14,14,14),(15,15,15,15,15,15,15),(16,16,16,16,16,16,16),(17,17,17,17,17,17,17),(18,18,18,18,18,18,18),(19,19,19,19,19,19,19),(20,20,20,20,20,20,20);
mysql> select * from linktable force index(PRIMARY) where link_type=1;
Empty set (0.00 sec)
mysql> select * from linktable force index(id1_type) where link_type=1;
+-----+-----+-----------+------------+------+------+---------+
| id1 | id2 | link_type | visibility | data | time | version |
+-----+-----+-----------+------------+------+------+---------+
| 1 | 1 | 1 | 1 | 1 | 1 | 1 |
+-----+-----+-----------+------------+------+------+---------+
1 row in set (0.00 sec)
mysql> update linktable set version=100 where link_type=1;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0
mysql> update linktable set version=100 where id1=1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
It doesn't work with reverse cf on secondary index, either:
CREATE TABLE
linktable(id1bigint(20) unsigned NOT NULL DEFAULT '0',id2bigint(20) unsigned NOT NULL DEFAULT '0',link_typebigint(20) unsigned NOT NULL DEFAULT '0',visibilitytinyint(3) NOT NULL DEFAULT '0',datavarchar(255) COLLATE latin1_bin NOT NULL DEFAULT '',timebigint(20) unsigned NOT NULL DEFAULT '0',versionint(11) unsigned NOT NULL DEFAULT '0',PRIMARY KEY (
link_type,id1,id2),KEY
id1_type(id1,link_type,visibility,time,id2,version,data) COMMENT 'rev:cf_id1_type') ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
insert into linktable values (1,1,1,1,1,1,1),(2,2,2,2,2,2,2),(3,3,3,3,3,3,3),(4,4,4,4,4,4,4),(5,5,5,5,5,5,5),(6,6,6,6,6,6,6),(7,7,7,7,7,7,7),(8,8,8,8,8,8,8),(9,9,9,9,9,9,9),(10,10,10,10,10,10,10),(11,11,11,11,11,11,11),(12,12,12,12,12,12,12),(13,13,13,13,13,13,13),(14,14,14,14,14,14,14),(15,15,15,15,15,15,15),(16,16,16,16,16,16,16),(17,17,17,17,17,17,17),(18,18,18,18,18,18,18),(19,19,19,19,19,19,19),(20,20,20,20,20,20,20);
mysql> select * from linktable force index(id1_type) where id1=1;
Empty set (0.00 sec)
mysql> select * from linktable force index(PRIMARY) where id1=1;
+-----+-----+-----------+------------+------+------+---------+
| id1 | id2 | link_type | visibility | data | time | version |
+-----+-----+-----------+------------+------+------+---------+
| 1 | 1 | 1 | 1 | 1 | 1 | 1 |
+-----+-----+-----------+------------+------+------+---------+
1 row in set (0.00 sec)
mysql> update linktable set version=100 where id1=10;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0
mysql> update linktable set version=100 where link_type=1;
Query OK, 1 row affected (0.03 sec)
Rows matched: 1 Changed: 1 Warnings: 0