Uploaded image for project: 'Percona Server'
  1. Percona Server
  2. PS-4026

MYR-7 is incomplete patch, MyRocks fails to allow index only scans on partitioned tables

    Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 5.7.18-14
    • Component/s: MyRocks
    • Labels:

      Description

      https://bugs.launchpad.net/percona-server/+bug/1670834

      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)
      

        Smart Checklist

          Attachments

            Activity

              People

              • Assignee:
                george.lorch George Lorch
                Reporter:
                george.lorch George Lorch
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: