fix perf event lost issue

This commit is contained in:
chaser-ch
2023-04-18 15:15:10 +00:00
committed by ob-robot
parent b9dbfe311c
commit d9edb2f8e9
2 changed files with 10 additions and 3 deletions

View File

@ -13,6 +13,7 @@
#include "lib/stat/ob_di_cache.h"
#include "lib/random/ob_random.h"
#include "lib/stat/ob_session_stat.h"
#include "lib/ob_lib_config.h"
namespace oceanbase
{
@ -220,17 +221,22 @@ ObDIThreadTenantCache::ObDIThreadTenantCache()
ObDIThreadTenantCache::~ObDIThreadTenantCache()
{
ObDIGlobalTenantCache::get_instance().unlink(this);
lib::ObDisableDiagnoseGuard disable_diagnose_guard;
if (extend_tenant_cache_ != nullptr) {
ob_delete(extend_tenant_cache_);
extend_tenant_cache_ = nullptr;
}
}
int ObDIThreadTenantCache::get_node(uint64_t tenant_id, ObDITenantCollect *&tenant_collect)
{
int ret = OB_SUCCESS;
if (OB_ISNULL(tenant_collect = tenant_cache_.get_node(tenant_id, tenant_collect))) {
if (OB_ISNULL(tenant_collect = tenant_cache_.get_node(tenant_id))) {
if (nullptr == extend_tenant_cache_) {
extend_tenant_cache_ = GET_TSI(ObDIBaseTenantCache<MAX_TENANT_NUM_PER_SERVER>);
extend_tenant_cache_ = OB_NEW(ObDIBaseTenantCache<MAX_TENANT_NUM_PER_SERVER>, "di_tenant_cache");
}
if (nullptr != extend_tenant_cache_) {
tenant_collect = extend_tenant_cache_->get_node(tenant_id, tenant_collect);
tenant_collect = extend_tenant_cache_->get_node(tenant_id, true /*replace*/);
}
if (nullptr == tenant_collect) {
ret = OB_TENANT_NOT_EXIST;

View File

@ -72,6 +72,7 @@ template <class T, size_t tag>
ObDITls<T, tag>::~ObDITls()
{
if (is_valid()) {
lib::ObDisableDiagnoseGuard disable_diagnose_guard;
ob_delete(instance_);
instance_ = nullptr;
}