diff --git a/src/storage/memtable/mvcc/ob_mvcc_trans_ctx.cpp b/src/storage/memtable/mvcc/ob_mvcc_trans_ctx.cpp index 66393f34ff..70889aa216 100644 --- a/src/storage/memtable/mvcc/ob_mvcc_trans_ctx.cpp +++ b/src/storage/memtable/mvcc/ob_mvcc_trans_ctx.cpp @@ -574,12 +574,14 @@ int ObTransCallbackMgr::remove_callbacks_for_fast_commit(const ObCallbackScopeAr int ObTransCallbackMgr::remove_callback_for_uncommited_txn(const memtable::ObMemtableSet *memtable_set) { int ret = OB_SUCCESS; - const bool serial_final = is_serial_final_(); - const share::SCN stop_scn = serial_final ? share::SCN::max_scn() : serial_sync_scn_; if (OB_ISNULL(memtable_set)) { ret = OB_INVALID_ARGUMENT; TRANS_LOG(WARN, "memtable is null", K(ret)); - } else { + } else if (!memtable_set->empty()) { + share::SCN stop_scn = share::SCN::min_scn(); + for (common::hash::ObHashSet::const_iterator iter = memtable_set->begin(); iter != memtable_set->end(); ++iter) { + stop_scn = share::SCN::max(((const memtable::ObMemtable *)iter->first)->get_max_end_scn(), stop_scn); + } CALLBACK_LISTS_FOREACH(idx, list) { if (OB_FAIL(list->remove_callbacks_for_remove_memtable(memtable_set, stop_scn))) { TRANS_LOG(WARN, "fifo remove callback fail", K(ret), K(idx), KPC(memtable_set)); diff --git a/src/storage/memtable/mvcc/ob_tx_callback_list.cpp b/src/storage/memtable/mvcc/ob_tx_callback_list.cpp index 773e4b683a..652c239bf2 100644 --- a/src/storage/memtable/mvcc/ob_tx_callback_list.cpp +++ b/src/storage/memtable/mvcc/ob_tx_callback_list.cpp @@ -349,9 +349,7 @@ int ObTxCallbackList::remove_callbacks_for_remove_memtable( // hence, acquire iter_latch is not required actually. int ret = OB_SUCCESS; LockGuard guard(*this, LOCK_MODE::LOCK_ITERATE); - const bool skip_checksum = is_skip_checksum_(); - const share::SCN right_bound = skip_checksum ? share::SCN::max_scn() - : (stop_scn.is_max() ? sync_scn_ : stop_scn); + const share::SCN right_bound = stop_scn; struct Functor final : public ObRemoveSyncCallbacksWCondFunctor { Functor(const bool need_remove_data = true, const bool is_reverse = false) : ObRemoveSyncCallbacksWCondFunctor(need_remove_data, is_reverse) {} @@ -384,7 +382,7 @@ int ObTxCallbackList::remove_callbacks_for_remove_memtable( functor.right_bound_ = right_bound; functor.memtable_set_ = memtable_set; - if (!skip_checksum) { + if (!is_skip_checksum_()) { functor.set_checksumer(checksum_scn_, &batch_checksum_); }