From b34367a7abf0b797c83cd0c7a3a969621d0c6c44 Mon Sep 17 00:00:00 2001 From: obdev Date: Tue, 7 Feb 2023 20:20:55 +0800 Subject: [PATCH] optimize retained tx ctx gc condition --- src/storage/tx/ob_tx_retain_ctx_mgr.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/storage/tx/ob_tx_retain_ctx_mgr.cpp b/src/storage/tx/ob_tx_retain_ctx_mgr.cpp index 5c1754d7b2..2db0dd9cc5 100644 --- a/src/storage/tx/ob_tx_retain_ctx_mgr.cpp +++ b/src/storage/tx/ob_tx_retain_ctx_mgr.cpp @@ -271,6 +271,7 @@ void ObTxRetainCtxMgr::try_advance_retain_ctx_gc(share::ObLSID ls_id) const int64_t CUR_LS_CNT = MTL(ObLSService *)->get_ls_map()->get_ls_count(); const int64_t IDLE_GC_INTERVAL = 30 * 60 * 1000 * 1000; // 30 min + const int64_t MIN_RETAIN_CTX_GC_THRESHOLD = 5000; ObTimeGuard tg(__func__, 1 * 1000 * 1000); SpinRLockGuard guard(retain_ctx_lock_); @@ -281,7 +282,7 @@ void ObTxRetainCtxMgr::try_advance_retain_ctx_gc(share::ObLSID ls_id) ObAdvanceLSCkptTask *task = nullptr; if (retain_ctx_list_.size() <= 0) { //do nothing - } else if (retain_ctx_list_.size() <= MAX_PART_CTX_COUNT / 10 / CUR_LS_CNT + } else if (retain_ctx_list_.size() <= std::min(MAX_PART_CTX_COUNT / 10 / CUR_LS_CNT, MIN_RETAIN_CTX_GC_THRESHOLD) && (OB_INVALID_TIMESTAMP == last_push_gc_task_ts_ || (OB_INVALID_TIMESTAMP != last_push_gc_task_ts_ && cur_time - last_push_gc_task_ts_ <= IDLE_GC_INTERVAL))) {