Commit 7e700bd2 authored by Sergei Petrunia's avatar Sergei Petrunia

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.
parent 8628c589
...@@ -11677,8 +11677,8 @@ int QUICK_SELECT_DESC::get_next() ...@@ -11677,8 +11677,8 @@ int QUICK_SELECT_DESC::get_next()
end_key.flag= (last_range->flag & NEAR_MAX ? HA_READ_BEFORE_KEY : end_key.flag= (last_range->flag & NEAR_MAX ? HA_READ_BEFORE_KEY :
HA_READ_AFTER_KEY); HA_READ_AFTER_KEY);
end_key.keypart_map= last_range->max_keypart_map; end_key.keypart_map= last_range->max_keypart_map;
result= file->prepare_range_scan((last_range->flag & NO_MIN_RANGE) ? NULL : &start_key, result= file->prepare_range_scan((last_range->flag & NO_MIN_RANGE) ? NULL : &end_key,
(last_range->flag & NO_MAX_RANGE) ? NULL : &end_key); (last_range->flag & NO_MAX_RANGE) ? NULL : &start_key);
if (result) if (result)
{ {
DBUG_RETURN(result); DBUG_RETURN(result);
......
...@@ -7464,13 +7464,6 @@ int ha_rocksdb::calc_eq_cond_len(const Rdb_key_def &kd, ...@@ -7464,13 +7464,6 @@ int ha_rocksdb::calc_eq_cond_len(const Rdb_key_def &kd,
*/ */
return slice.size() - bytes_changed_by_succ; 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) { if (end_key) {
*end_key_packed_size = *end_key_packed_size =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment