fix TxLSLogBuf mem leak

This commit is contained in:
obdev
2023-05-06 06:41:48 +00:00
committed by ob-robot
parent 8bcb1ce7a6
commit 631fde402f
4 changed files with 10 additions and 7 deletions

View File

@ -203,7 +203,7 @@ void ObLSTxCtxMgr::destroy()
if (IS_INIT) {
ls_log_writer_.destroy();
is_inited_ = false;
TRANS_LOG(INFO, "ObLSTxCtxMgr destroyed", K_(ls_id));
TRANS_LOG(INFO, "ObLSTxCtxMgr destroyed", KP(this), K_(ls_id));
}
}
@ -2178,9 +2178,9 @@ int ObTxCtxMgr::remove_ls(const ObLSID &ls_id, const bool graceful)
TRANS_LOG(WARN, "remove ls error", KR(ret), K(ls_id));
} else {
ATOMIC_INC(&ls_release_cnt_);
TRANS_LOG(INFO, "remove ls success", "total_alloc", ls_alloc_cnt_,
"total_release", ls_release_cnt_,
K(ls_id));
TRANS_LOG(INFO, "remove ls success", KP(ls_tx_ctx_mgr), K(ls_id),
"total_alloc", ls_alloc_cnt_,
"total_release", ls_release_cnt_);
}
revert_ls_tx_ctx_mgr(ls_tx_ctx_mgr);
}
@ -2194,7 +2194,7 @@ int ObTxCtxMgr::remove_ls(const ObLSID &ls_id, const bool graceful)
// do nothing
}
}
UNUSED(MAX_RETRY_NUM);
TRANS_LOG(INFO, "remove ls", KR(ret), K(ls_id), K(graceful));
return ret;
}

View File

@ -180,6 +180,7 @@ ObLSTxCtxMgr *ObLSTxCtxMgrFactory::alloc(const uint64_t tenant_id)
partition_trans_ctx_mgr = new(ptr) ObLSTxCtxMgr;
(void)ATOMIC_FAA(&alloc_count_, 1);
}
TRANS_LOG(INFO, "alloc ls tx ctx mgr", KP(partition_trans_ctx_mgr));
return partition_trans_ctx_mgr;
}
@ -191,6 +192,7 @@ void ObLSTxCtxMgrFactory::release(ObLSTxCtxMgr *partition_trans_ctx_mgr)
} else {
partition_trans_ctx_mgr->~ObLSTxCtxMgr();
ob_free(partition_trans_ctx_mgr);
TRANS_LOG(INFO, "release ls tx ctx mgr", KP(partition_trans_ctx_mgr));
partition_trans_ctx_mgr = NULL;
(void)ATOMIC_FAA(&release_count_, 1);
}

View File

@ -443,7 +443,7 @@ public:
tmp_ret = OB_INVALID_ARGUMENT;
TRANS_LOG_RET(WARN, tmp_ret, "invalid argument", KP(ls_tx_ctx_mgr));
} else {
const share::ObLSID &ls_id = ls_tx_ctx_mgr->get_ls_id();
const share::ObLSID ls_id = ls_tx_ctx_mgr->get_ls_id();
if (!ls_id.is_valid()) {
tmp_ret = OB_INVALID_ARGUMENT;
@ -457,8 +457,8 @@ public:
ls_tx_ctx_mgr = NULL;
bool_ret = true;
}
TRANS_LOG_RET(INFO, tmp_ret, "remove ls", K(ls_id), KP(ls_tx_ctx_mgr));
}
UNUSED(tmp_ret);
return bool_ret;
}
};

View File

@ -416,6 +416,7 @@ void ObTxLSLogWriter::destroy_cbs_(common::ObDList<ObTxLSLogCb> &cbs)
ObTxLSLogCb *cb_ptr = nullptr;
while (!cbs.is_empty()) {
if (OB_NOT_NULL(cb_ptr = cbs.remove_first())) {
cb_ptr->~ObTxLSLogCb();
ob_free(cb_ptr);
}
}