[Commits] dc0afd7: Make index_read_map(HA_READ_KEY_OR_PREV) return HA_ERR_UNSUPPORTED

Sergei Petrunia psergey at askmonty.org
Thu Mar 19 00:09:36 EET 2015


revision-id: dc0afd7c26aec993da7802f26a72d10364613311
parent(s): 04a66e82848c5a73eacdcb79be49adcd96f7572e
committer: Sergei Petrunia
branch nick: mysql-5.6-rocksdb-issue16-splitthefix-2
timestamp: 2015-03-19 01:09:36 +0300
message:

Make index_read_map(HA_READ_KEY_OR_PREV) return HA_ERR_UNSUPPORTED

Summary:
- The code that handles HA_READ_KEY_OR_PREV was either incorrect or
  inefficient.
- SQL Layer never generates ranges with find_flag=HA_READ_KEY_OR_PREV
  (the only way to use it is a HANDLER command)
- Because of the above, we will HA_ERR_UNSUPPORTED, for now. When
  somebody needs this find_flag, it can be implemented.

Test Plan: N/A

Reviewers: maykov, hermanlee4, jtolmer, yoshinorim

Differential Revision: https://reviews.facebook.net/D35337

---
 storage/rocksdb/ha_rocksdb.cc |   25 ++-----------------------
 1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index e0eda64..76ede34 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -2842,29 +2842,8 @@ int ha_rocksdb::index_read_map(uchar *buf, const uchar *key,
   }
   case HA_READ_KEY_OR_PREV:
   {
-    if (!scan_it->Valid())
-    {
-      /*
-        We're after the last value in the database. It could be we needed the
-        last one.
-      */
-      scan_it->SeekToLast();
-    }
-    /* We should see a key that is less-or-equal than specified */
-    bool in_key;
-    bool have_row;
-    while ((have_row= scan_it->Valid()))
-    {
-      rkey= scan_it->key();
-      if (!(in_key= kd->covers_key(rkey.data(), rkey.size())) ||
-           kd->cmp_full_keys(rkey.data(), rkey.size(), 
-                             slice.data(), slice.size(),
-                             n_used_parts) <= 0)
-        break;
-      scan_it->Prev();
-    }
-    if (!have_row || !in_key)
-      rc= HA_ERR_END_OF_FILE;
+    /* This flag is not used by the SQL layer, so we don't support it yet. */
+    rc= HA_ERR_UNSUPPORTED;
     break;
   }
   case HA_READ_PREFIX_LAST:


More information about the commits mailing list