diff --git a/mittest/mtlenv/test_tx_data_table.cpp b/mittest/mtlenv/test_tx_data_table.cpp index 676f5aea72..212516f496 100644 --- a/mittest/mtlenv/test_tx_data_table.cpp +++ b/mittest/mtlenv/test_tx_data_table.cpp @@ -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_(); diff --git a/src/storage/tx_table/ob_tx_data_memtable.cpp b/src/storage/tx_table/ob_tx_data_memtable.cpp index 457984fa45..84e00696d3 100644 --- a/src/storage/tx_table/ob_tx_data_memtable.cpp +++ b/src/storage/tx_table/ob_tx_data_memtable.cpp @@ -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; } diff --git a/src/storage/tx_table/ob_tx_data_memtable.h b/src/storage/tx_table/ob_tx_data_memtable.h index f875ec13d3..fca3cf1a7f 100644 --- a/src/storage/tx_table/ob_tx_data_memtable.h +++ b/src/storage/tx_table/ob_tx_data_memtable.h @@ -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,