diff --git a/mittest/mtlenv/storage/blocksstable/test_co_sstable_row_scanner.cpp b/mittest/mtlenv/storage/blocksstable/test_co_sstable_row_scanner.cpp index 00208a8cef..7e5f23e79c 100644 --- a/mittest/mtlenv/storage/blocksstable/test_co_sstable_row_scanner.cpp +++ b/mittest/mtlenv/storage/blocksstable/test_co_sstable_row_scanner.cpp @@ -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)); ASSERT_EQ(range_row_ids_[4].start_row_id_, start_row_id); 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); 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)); ASSERT_EQ(range_row_ids_[4].end_row_id_, start_row_id); 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); forward_blockscan_to_end(&multi_scanner_, end_row_id, block_scan_state, is_reverse); ASSERT_EQ(border_id1 + 1, end_row_id); ASSERT_EQ(BLOCKSCAN_FINISH, block_scan_state); - consume_rows_by_row_store(&multi_scanner_, border_id1, range_row_ids_[4].start_row_id_, - is_reverse); + consume_rows_by_row_store(&multi_scanner_, border_id1, range_row_ids_[4].start_row_id_, is_reverse); check_iter_end(&multi_scanner_); } diff --git a/src/storage/access/ob_index_tree_prefetcher.cpp b/src/storage/access/ob_index_tree_prefetcher.cpp index 184ad83030..c13dd4dd46 100644 --- a/src/storage/access/ob_index_tree_prefetcher.cpp +++ b/src/storage/access/ob_index_tree_prefetcher.cpp @@ -1280,11 +1280,13 @@ OB_INLINE static int binary_check_micro_infos( if (OB_UNLIKELY(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--) { + for (; OB_SUCC(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)); + } else if (cmp_ret != 0) { + break; } } } diff --git a/src/storage/column_store/ob_co_prefetcher.cpp b/src/storage/column_store/ob_co_prefetcher.cpp index aa9e0c7752..76809c8a40 100644 --- a/src/storage/column_store/ob_co_prefetcher.cpp +++ b/src/storage/column_store/ob_co_prefetcher.cpp @@ -30,6 +30,9 @@ void ObCOPrefetcher::reuse() set_range_scan_finish(); block_scan_border_row_id_ = OB_INVALID_CS_ROW_ID; 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) @@ -258,7 +261,6 @@ int ObCOPrefetcher::refresh_blockscan_checker_in_leaf_level( const bool is_reverse = access_ctx_->query_flag_.is_reverse_scan(); ObSSTableReadHandle &read_handle = read_handles_[cur_range_fetch_idx_ % max_range_prefetching_cnt_]; 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. int64_t pos = start_micro_idx; @@ -271,7 +273,7 @@ int ObCOPrefetcher::refresh_blockscan_checker_in_leaf_level( pos = micro_end_idx + 1; } else { 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; } } @@ -292,8 +294,7 @@ int ObCOPrefetcher::refresh_blockscan_checker_in_leaf_level( int32_t cur_block_scan_level = get_cur_level_of_block_scan(); if (pos <= micro_end_idx || INVALID_LEVEL == cur_block_scan_level - || is_reverse - || is_out_row_found) { + || is_reverse) { if (INVALID_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)); } 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", - 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; }