Skip to content

Commit 7e700bd

Browse files
committed
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.
1 parent 8628c58 commit 7e700bd

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

sql/opt_range.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11677,8 +11677,8 @@ int QUICK_SELECT_DESC::get_next()
1167711677
end_key.flag= (last_range->flag & NEAR_MAX ? HA_READ_BEFORE_KEY :
1167811678
HA_READ_AFTER_KEY);
1167911679
end_key.keypart_map= last_range->max_keypart_map;
11680-
result= file->prepare_range_scan((last_range->flag & NO_MIN_RANGE) ? NULL : &start_key,
11681-
(last_range->flag & NO_MAX_RANGE) ? NULL : &end_key);
11680+
result= file->prepare_range_scan((last_range->flag & NO_MIN_RANGE) ? NULL : &end_key,
11681+
(last_range->flag & NO_MAX_RANGE) ? NULL : &start_key);
1168211682
if (result)
1168311683
{
1168411684
DBUG_RETURN(result);

storage/rocksdb/ha_rocksdb.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7464,13 +7464,6 @@ int ha_rocksdb::calc_eq_cond_len(const Rdb_key_def &kd,
74647464
*/
74657465
return slice.size() - bytes_changed_by_succ;
74667466
}
7467-
if (find_flag == HA_READ_PREFIX_LAST_OR_PREV) {
7468-
/*
7469-
We are interested in records with or without the specified prefix, so
7470-
the only limit is that records are from this index
7471-
*/
7472-
return Rdb_key_def::INDEX_NUMBER_SIZE;
7473-
}
74747467

74757468
if (end_key) {
74767469
*end_key_packed_size =

0 commit comments

Comments
 (0)