From f44dabec3b8174f05edb3c8bcd04d266a4dfa8d1 Mon Sep 17 00:00:00 2001 From: KyrielightWei Date: Thu, 20 Jul 2023 03:42:19 +0000 Subject: [PATCH] set CUR_LS_CNT as 1 if no ls --- src/storage/tx/ob_tx_retain_ctx_mgr.cpp | 5 ++++- 1 file changed, 4 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 aeac2336c..768d7d120 100644 --- a/src/storage/tx/ob_tx_retain_ctx_mgr.cpp +++ b/src/storage/tx/ob_tx_retain_ctx_mgr.cpp @@ -276,7 +276,10 @@ void ObTxRetainCtxMgr::try_advance_retain_ctx_gc(share::ObLSID ls_id) int ret = OB_SUCCESS; const int64_t tenant_id = MTL_ID(); - const int64_t CUR_LS_CNT = MTL(ObLSService *)->get_ls_map()->get_ls_count(); + int64_t CUR_LS_CNT = MTL(ObLSService *)->get_ls_map()->get_ls_count(); + if (CUR_LS_CNT == 0) { + CUR_LS_CNT = 1; + } const int64_t IDLE_GC_INTERVAL = 30 * 60 * 1000 * 1000; // 30 min // const int64_t MIN_RETAIN_CTX_GC_THRESHOLD = 1000; const int64_t MIN_RETAIN_CTX_GC_THRESHOLD = ::oceanbase::lib::get_tenant_memory_limit(tenant_id)