index only scans do not work for partitioned MyRocks tables and extended keys

Bug #1670834 reported by George Ormond Lorch III on 2017-03-07
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.6
Fix Released
Medium
George Ormond Lorch III
5.7
Fix Released
Medium
George Ormond Lorch III

Bug Description

MYR-7 did not import the full set of sql/table.cc changes required for MyRocks.
There are two commits that need imported for MyRocks to behave correctly:
https://github.com/facebook/mysql-5.6/commit/070a257a1c3013db10b6a074340b8a8ec9e5edd0
https://github.com/facebook/mysql-5.6/commit/4ea109268b634baaabd756c12fbe4635a869e4d1

Without these full changes there are mtr failures due to different query plans.
One example, without the full patches in place:

mysql> create table t1 ( pk int primary key, col1 int, col2 int, key (col1) ) engine=rocksdb partition by hash(pk) partitions 2;
Query OK, 0 rows affected, 1 warning (0.08 sec)

mysql> insert into t1 values (1,10,10);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> insert into t1 values (2,10,10);
Query OK, 1 row affected (0.00 sec)

mysql> insert into t1 values (11,20,20);
Query OK, 1 row affected (0.00 sec)

mysql> insert into t1 values (12,20,20);
Query OK, 1 row affected (0.00 sec)

mysql> explain select pk from t1 force index(col1) where col1=10\G;
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: t1
   partitions: p0,p1
         type: ref
possible_keys: col1
          key: col1
      key_len: 5
          ref: const
         rows: 2
     filtered: 100.00
        Extra: NULL
1 row in set, 1 warning (0.00 sec)

And now with the patches:

mysql> create table t1 ( pk int primary key, col1 int, col2 int, key (col1) ) engine=rocksdb partition by hash(pk) partitions 2;
Query OK, 0 rows affected, 1 warning (0.08 sec)

mysql> insert into t1 values (1,10,10);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> insert into t1 values (2,10,10);
Query OK, 1 row affected (0.00 sec)

mysql> insert into t1 values (11,20,20);
Query OK, 1 row affected (0.00 sec)

mysql> insert into t1 values (12,20,20);
Query OK, 1 row affected (0.00 sec)

mysql> explain select pk from t1 force index(col1) where col1=10\G;
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: t1
   partitions: p0,p1
         type: ref
possible_keys: col1
          key: col1
      key_len: 5
          ref: const
         rows: 2
     filtered: 100.00
        Extra: Using index
1 row in set, 1 warning (0.00 sec)

This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers