[FIX] pre process tx data memtable

This commit is contained in:
ZenoWang
2024-07-23 14:01:42 +00:00
committed by ob-robot
parent 4dd41a05c9
commit caa52087d4
3 changed files with 11 additions and 2 deletions

View File

@ -60,6 +60,7 @@ int64_t ObTxDataMemtable::PERIODICAL_SELECT_INTERVAL_NS = 10LL;
int ObTxDataMemtable::get_past_commit_versions_(ObCommitVersionsArray &past_commit_versions)
{
int ret = OB_SUCCESS;
ret = past_commit_versions.array_.push_back(ObCommitVersionsArray::Node(SCN::max_scn(), SCN::max_scn()));
return ret;
}
@ -186,7 +187,6 @@ public:
void do_print_leak_slice_test();
private:
void insert_tx_data_();
void insert_abort_tx_data_();

View File

@ -361,6 +361,7 @@ int ObTxDataMemtable::pre_process_commit_version_row_(ObTxData *fake_tx_data)
STORAGE_LOG(WARN, "periodical select commit version failed.", KR(ret));
} else if (OB_FAIL(get_past_commit_versions_(past_commit_versions)/*step 2*/)) {
STORAGE_LOG(WARN, "get past commit versions failed.", KR(ret), K(past_commit_versions));
} else if (FALSE_IT(clear_fake_node_if_exist_(past_commit_versions))) {
} else if (do_recycle_ && OB_FAIL(memtable_mgr_->get_tx_data_table()->get_recycle_scn(recycle_scn) /*step 3*/)) {
STORAGE_LOG(WARN, "get recycle ts failed.", KR(ret));
} else if (OB_FAIL(merge_cur_and_past_commit_verisons_(recycle_scn, cur_commit_versions,/*step 4*/
@ -529,6 +530,14 @@ int ObTxDataMemtable::get_past_commit_versions_(ObCommitVersionsArray &past_comm
return ret;
}
void ObTxDataMemtable::clear_fake_node_if_exist_(ObCommitVersionsArray &past_commit_versions)
{
if (1 == past_commit_versions.array_.count() && past_commit_versions.array_.at(0).commit_version_.is_max()) {
STORAGE_LOG(INFO, "clear fake commit version node", K(past_commit_versions));
past_commit_versions.reset();
}
}
int ObTxDataMemtable::merge_cur_and_past_commit_verisons_(const SCN recycle_scn,
ObCommitVersionsArray &cur_commit_versions,
ObCommitVersionsArray &past_commit_versions,
@ -619,7 +628,6 @@ int ObTxDataMemtable::merge_pre_process_node_(const int64_t step_len,
STORAGE_LOG(WARN, "push back commit version node failed.", KR(ret), KPC(this));
}
}
}
return ret;
}

View File

@ -396,6 +396,7 @@ private: // ObTxDataMemtable
ObCommitVersionsArray::Node &node);
int get_past_commit_versions_(ObCommitVersionsArray &past_commit_versions);
void clear_fake_node_if_exist_(ObCommitVersionsArray &past_commit_versions);
int merge_cur_and_past_commit_verisons_(const share::SCN recycle_scn,
ObCommitVersionsArray &cur_commit_versions,