Fix the bug of lookup iter failing to switch partition correctly

This commit is contained in:
leslieyuchen
2023-03-24 08:15:13 +00:00
committed by ob-robot
parent e05be5a00f
commit a8778f6a45
6 changed files with 20 additions and 20 deletions

View File

@ -593,11 +593,12 @@ int ObDASScanOp::reuse_iter()
int &ret = errcode_;
ObITabletScan &tsc_service = get_tsc_service();
ObLocalIndexLookupOp *lookup_op = get_lookup_op();
scan_param_.need_switch_param_ = need_switch_param();
if (OB_FAIL(tsc_service.reuse_scan_iter(need_switch_param(), get_storage_scan_iter()))) {
const ObTabletID &storage_tablet_id = scan_param_.tablet_id_;
scan_param_.need_switch_param_ = (storage_tablet_id.is_valid() && storage_tablet_id != tablet_id_ ? true : false);
if (OB_FAIL(tsc_service.reuse_scan_iter(scan_param_.need_switch_param_, get_storage_scan_iter()))) {
LOG_WARN("reuse scan iterator failed", K(ret));
} else if (lookup_op != nullptr
&& OB_FAIL(lookup_op->reset_lookup_state(need_switch_param()))) {
&& OB_FAIL(lookup_op->reset_lookup_state())) {
LOG_WARN("reuse lookup iterator failed", K(ret));
} else {
scan_param_.key_ranges_.reuse();
@ -933,6 +934,8 @@ int ObLocalIndexLookupOp::do_index_lookup()
}
}
} else {
const ObTabletID &storage_tablet_id = scan_param_.tablet_id_;
scan_param_.need_switch_param_ = (storage_tablet_id.is_valid() && storage_tablet_id != tablet_id_ ? true : false);
scan_param_.tablet_id_ = tablet_id_;
scan_param_.ls_id_ = ls_id_;
if (OB_FAIL(reuse_iter())) {
@ -982,7 +985,7 @@ int ObLocalIndexLookupOp::process_next_index_batch_for_row()
{
int ret = OB_SUCCESS;
if (need_next_index_batch()) {
reset_lookup_state(false);
reset_lookup_state();
index_end_ = false;
state_ = INDEX_SCAN;
} else {
@ -998,7 +1001,7 @@ int ObLocalIndexLookupOp::process_next_index_batch_for_rows(int64_t &count)
if (OB_FAIL(check_lookup_row_cnt())) {
LOG_WARN("check lookup row cnt failed", K(ret));
} else if (need_next_index_batch()) {
reset_lookup_state(false);
reset_lookup_state();
index_end_ = false;
state_ = INDEX_SCAN;
ret = OB_SUCCESS;
@ -1163,7 +1166,7 @@ int ObLocalIndexLookupOp::reuse_iter()
}
return ret;
}
int ObLocalIndexLookupOp::reset_lookup_state(bool need_switch_param)
int ObLocalIndexLookupOp::reset_lookup_state()
{
int ret = OB_SUCCESS;
state_ = INDEX_SCAN;
@ -1172,7 +1175,6 @@ int ObLocalIndexLookupOp::reset_lookup_state(bool need_switch_param)
// Keep lookup_rtdef_->stmt_allocator_.alloc_ consistent with index_rtdef_->stmt_allocator_.alloc_
// to avoid memory expansion
if (lookup_iter_ != nullptr) {
scan_param_.need_switch_param_ = need_switch_param;
scan_param_.key_ranges_.reuse();
scan_param_.ss_key_ranges_.reuse();
}