[CP] Fix multi range reverse scan blockscan

This commit is contained in:
haitaoyang
2023-07-18 07:18:30 +00:00
committed by ob-robot
parent 10c62a726a
commit c0c69aa641

View File

@ -1240,10 +1240,23 @@ OB_INLINE static int binary_check_micro_infos(
int64_t check_border_idx = start + (found - first);
if (is_reverse) {
// [check_border_idx - 1] is the last micro whose endkey greater than border_rowkey in reverse scan, need move forward
check_border_idx --;
check_border_idx--;
if (OB_UNLIKELY(check_border_idx == end && check_border_idx > 0)) {
// move to left if the two rightmost endkeys is same(possible in multiple ranges)
int cmp_ret = 0;
for (; OB_SUCC(ret) && 0 == cmp_ret && check_border_idx > start; check_border_idx--) {
const ObDatumRowkey *cur_endkey = (micro_infos + check_border_idx)->endkey_;
const ObDatumRowkey *prev_endkey = (micro_infos + check_border_idx - 1)->endkey_;
if (OB_FAIL(cur_endkey->compare(*prev_endkey, datum_utils, cmp_ret, false))) {
LOG_WARN("fail to compare rowkey", K(ret), KPC(cur_endkey), KPC(prev_endkey));
}
}
}
}
for (int64_t idx = start; idx < check_border_idx; idx++) {
micro_infos[idx].set_blockscan();
if (OB_SUCC(ret)) {
for (int64_t idx = start; idx < check_border_idx; idx++) {
micro_infos[idx].set_blockscan();
}
}
}
}