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.
This commit is contained in:
Sergei Petrunia 2018-04-09 19:12:23 +03:00
commit 7e700bd2a8
2 changed files with 2 additions and 9 deletions

View file

@ -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);

View file

@ -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 =