Fix the issue of inaccurate reading of multiple ranges in columnar storage for multiple partition scenarios
This commit is contained in:
@ -599,7 +599,7 @@ void TestCOSSTableRowScanner::test_row_scan_and_column_scan_with_multi_range2()
|
|||||||
OK(multi_scanner_.get_blockscan_start(start_row_id, range_idx, block_scan_state));
|
OK(multi_scanner_.get_blockscan_start(start_row_id, range_idx, block_scan_state));
|
||||||
ASSERT_EQ(range_row_ids_[4].start_row_id_, start_row_id);
|
ASSERT_EQ(range_row_ids_[4].start_row_id_, start_row_id);
|
||||||
ASSERT_EQ(4, range_idx);
|
ASSERT_EQ(4, range_idx);
|
||||||
ASSERT_EQ(PENDING_BLOCK_SCAN, multi_scanner_.prefetcher_.block_scan_state_);
|
ASSERT_TRUE(PENDING_BLOCK_SCAN == multi_scanner_.prefetcher_.block_scan_state_ || IN_END_OF_RANGE == multi_scanner_.prefetcher_.block_scan_state_);
|
||||||
ASSERT_EQ(BLOCKSCAN_RANGE, block_scan_state);
|
ASSERT_EQ(BLOCKSCAN_RANGE, block_scan_state);
|
||||||
|
|
||||||
forward_blockscan_to_end(&multi_scanner_, end_row_id, block_scan_state, is_reverse);
|
forward_blockscan_to_end(&multi_scanner_, end_row_id, block_scan_state, is_reverse);
|
||||||
@ -676,14 +676,13 @@ void TestCOSSTableRowScanner::test_reverse_row_scan_and_column_scan_with_multi_r
|
|||||||
OK(multi_scanner_.get_blockscan_start(start_row_id, range_idx, block_scan_state));
|
OK(multi_scanner_.get_blockscan_start(start_row_id, range_idx, block_scan_state));
|
||||||
ASSERT_EQ(range_row_ids_[4].end_row_id_, start_row_id);
|
ASSERT_EQ(range_row_ids_[4].end_row_id_, start_row_id);
|
||||||
ASSERT_EQ(4, range_idx);
|
ASSERT_EQ(4, range_idx);
|
||||||
ASSERT_EQ(PENDING_BLOCK_SCAN, multi_scanner_.prefetcher_.block_scan_state_);
|
ASSERT_TRUE(PENDING_BLOCK_SCAN == multi_scanner_.prefetcher_.block_scan_state_ || IN_END_OF_RANGE == multi_scanner_.prefetcher_.block_scan_state_);
|
||||||
ASSERT_EQ(BLOCKSCAN_RANGE, block_scan_state);
|
ASSERT_EQ(BLOCKSCAN_RANGE, block_scan_state);
|
||||||
|
|
||||||
forward_blockscan_to_end(&multi_scanner_, end_row_id, block_scan_state, is_reverse);
|
forward_blockscan_to_end(&multi_scanner_, end_row_id, block_scan_state, is_reverse);
|
||||||
ASSERT_EQ(border_id1 + 1, end_row_id);
|
ASSERT_EQ(border_id1 + 1, end_row_id);
|
||||||
ASSERT_EQ(BLOCKSCAN_FINISH, block_scan_state);
|
ASSERT_EQ(BLOCKSCAN_FINISH, block_scan_state);
|
||||||
consume_rows_by_row_store(&multi_scanner_, border_id1, range_row_ids_[4].start_row_id_,
|
consume_rows_by_row_store(&multi_scanner_, border_id1, range_row_ids_[4].start_row_id_, is_reverse);
|
||||||
is_reverse);
|
|
||||||
check_iter_end(&multi_scanner_);
|
check_iter_end(&multi_scanner_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1280,11 +1280,13 @@ OB_INLINE static int binary_check_micro_infos(
|
|||||||
if (OB_UNLIKELY(check_border_idx > 0)) {
|
if (OB_UNLIKELY(check_border_idx > 0)) {
|
||||||
// move to left if the two rightmost endkeys is same(possible in multiple ranges)
|
// move to left if the two rightmost endkeys is same(possible in multiple ranges)
|
||||||
int cmp_ret = 0;
|
int cmp_ret = 0;
|
||||||
for (; OB_SUCC(ret) && 0 == cmp_ret && check_border_idx > start; check_border_idx--) {
|
for (; OB_SUCC(ret) && check_border_idx > start; check_border_idx--) {
|
||||||
const ObDatumRowkey *cur_endkey = (micro_infos + check_border_idx)->endkey_;
|
const ObDatumRowkey *cur_endkey = (micro_infos + check_border_idx)->endkey_;
|
||||||
const ObDatumRowkey *prev_endkey = (micro_infos + check_border_idx - 1)->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))) {
|
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));
|
LOG_WARN("fail to compare rowkey", K(ret), KPC(cur_endkey), KPC(prev_endkey));
|
||||||
|
} else if (cmp_ret != 0) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,9 @@ void ObCOPrefetcher::reuse()
|
|||||||
set_range_scan_finish();
|
set_range_scan_finish();
|
||||||
block_scan_border_row_id_ = OB_INVALID_CS_ROW_ID;
|
block_scan_border_row_id_ = OB_INVALID_CS_ROW_ID;
|
||||||
ObIndexTreeMultiPassPrefetcher::reuse();
|
ObIndexTreeMultiPassPrefetcher::reuse();
|
||||||
|
for (int i = 0; i < max_range_prefetching_cnt_; ++i) {
|
||||||
|
read_handles_[i].reuse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObCOPrefetcher::refresh_blockscan_checker(const int64_t start_micro_idx, const ObDatumRowkey &border_rowkey)
|
int ObCOPrefetcher::refresh_blockscan_checker(const int64_t start_micro_idx, const ObDatumRowkey &border_rowkey)
|
||||||
@ -258,7 +261,6 @@ int ObCOPrefetcher::refresh_blockscan_checker_in_leaf_level(
|
|||||||
const bool is_reverse = access_ctx_->query_flag_.is_reverse_scan();
|
const bool is_reverse = access_ctx_->query_flag_.is_reverse_scan();
|
||||||
ObSSTableReadHandle &read_handle = read_handles_[cur_range_fetch_idx_ % max_range_prefetching_cnt_];
|
ObSSTableReadHandle &read_handle = read_handles_[cur_range_fetch_idx_ % max_range_prefetching_cnt_];
|
||||||
int64_t micro_end_idx = read_handle.micro_end_idx_;
|
int64_t micro_end_idx = read_handle.micro_end_idx_;
|
||||||
bool is_out_row_found = false;
|
|
||||||
|
|
||||||
// pos points to the next data micro block that we should open.
|
// pos points to the next data micro block that we should open.
|
||||||
int64_t pos = start_micro_idx;
|
int64_t pos = start_micro_idx;
|
||||||
@ -271,7 +273,7 @@ int ObCOPrefetcher::refresh_blockscan_checker_in_leaf_level(
|
|||||||
pos = micro_end_idx + 1;
|
pos = micro_end_idx + 1;
|
||||||
} else {
|
} else {
|
||||||
for (; pos <= micro_end_idx; ++pos) {
|
for (; pos <= micro_end_idx; ++pos) {
|
||||||
if (!micro_data_infos_[pos % max_micro_handle_cnt_].can_blockscan(false)) {
|
if (!micro_data_infos_[pos % max_micro_handle_cnt_].can_blockscan_) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -292,8 +294,7 @@ int ObCOPrefetcher::refresh_blockscan_checker_in_leaf_level(
|
|||||||
int32_t cur_block_scan_level = get_cur_level_of_block_scan();
|
int32_t cur_block_scan_level = get_cur_level_of_block_scan();
|
||||||
if (pos <= micro_end_idx
|
if (pos <= micro_end_idx
|
||||||
|| INVALID_LEVEL == cur_block_scan_level
|
|| INVALID_LEVEL == cur_block_scan_level
|
||||||
|| is_reverse
|
|| is_reverse) {
|
||||||
|| is_out_row_found) {
|
|
||||||
if (INVALID_LEVEL != cur_block_scan_level) {
|
if (INVALID_LEVEL != cur_block_scan_level) {
|
||||||
reset_blockscan_for_target_level(cur_block_scan_level);
|
reset_blockscan_for_target_level(cur_block_scan_level);
|
||||||
}
|
}
|
||||||
@ -307,10 +308,10 @@ int ObCOPrefetcher::refresh_blockscan_checker_in_leaf_level(
|
|||||||
K(pos), K_(block_scan_state));
|
K(pos), K_(block_scan_state));
|
||||||
}
|
}
|
||||||
LOG_DEBUG("ObCOPrefetcher::refresh_blockscan_checker_in_leaf_level advance",
|
LOG_DEBUG("ObCOPrefetcher::refresh_blockscan_checker_in_leaf_level advance",
|
||||||
K(ret), K(start_micro_idx), K(pos), K(is_range_end), K(is_out_row_found), K_(block_scan_state));
|
K(ret), K(start_micro_idx), K(pos), K(is_range_end), K_(block_scan_state));
|
||||||
}
|
}
|
||||||
LOG_DEBUG("ObCOPrefetcher::refresh_blockscan_checker_in_leaf_level end",
|
LOG_DEBUG("ObCOPrefetcher::refresh_blockscan_checker_in_leaf_level end",
|
||||||
K(ret), K(start_micro_idx), K(pos), K(border_rowkey), K(is_out_row_found), KPC(this));
|
K(ret), K(start_micro_idx), K(pos), K(border_rowkey), KPC(this));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user