[Commits] 7e700bd: Fix ha_rocksdb::calc_eq_cond_len() to handle HA_READ_PREFIX_LAST_OR_PREV correctly

Sergei Petrunia psergey at askmonty.org
Mon Apr 9 19:12:23 EEST 2018


revision-id: 7e700bd2a81ae4b37145f1c32bb0902c72856d2d
parent(s): 8628c589f69aea164ec1865f52eb0f5bc5154ed8
committer: Sergei Petrunia
branch nick: 10.2-r10
timestamp: 2018-04-09 19:12:23 +0300
message:

Fix ha_rocksdb::calc_eq_cond_len() to handle HA_READ_PREFIX_LAST_OR_PREV correctly
This is Variant#2.
- Undo Variant#1
- Instead, swap the range bounds if we are doing a reverse-ordered scan.

---
 sql/opt_range.cc              | 4 ++--
 storage/rocksdb/ha_rocksdb.cc | 7 -------
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index cc57469..bc047b2 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -11677,8 +11677,8 @@ int QUICK_SELECT_DESC::get_next()
     end_key.flag=     (last_range->flag & NEAR_MAX ? HA_READ_BEFORE_KEY :
                        HA_READ_AFTER_KEY);
     end_key.keypart_map= last_range->max_keypart_map;
-    result= file->prepare_range_scan((last_range->flag & NO_MIN_RANGE) ? NULL : &start_key,
-                                     (last_range->flag & NO_MAX_RANGE) ? NULL : &end_key);
+    result= file->prepare_range_scan((last_range->flag & NO_MIN_RANGE) ? NULL : &end_key,
+                                     (last_range->flag & NO_MAX_RANGE) ? NULL : &start_key);
     if (result)
     {
       DBUG_RETURN(result);
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index 9d3d07e..5f19fac 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -7464,13 +7464,6 @@ int ha_rocksdb::calc_eq_cond_len(const Rdb_key_def &kd,
     */
     return slice.size() - bytes_changed_by_succ;
   }
-  if (find_flag == HA_READ_PREFIX_LAST_OR_PREV) {
-    /*
-      We are interested in records with or without the specified prefix, so
-      the only limit is that records are from this index
-    */
-    return Rdb_key_def::INDEX_NUMBER_SIZE;
-  }
 
   if (end_key) {
     *end_key_packed_size =


More information about the commits mailing list