fix dtl interm result memleak and core when drop tenant

This commit is contained in:
obdev
2023-02-08 20:51:51 +08:00
committed by ob-robot
parent a493f8590d
commit 62bc285f75
2 changed files with 9 additions and 2 deletions

View File

@ -168,7 +168,7 @@ void ObAtomicAppendPartBlockCall::operator() (common::hash::HashMapPair<ObDTLInt
int ObEraseTenantIntermResultInfo::operator() (common::hash::HashMapPair<ObDTLIntermResultKey, ObDTLIntermResultInfo *> &entry)
{
int ret = OB_SUCCESS;
if (entry.second->datum_store_->get_tenant_id() == tenant_id_) {
if (entry.second->tenant_id_ == tenant_id_) {
if (OB_FAIL(expire_keys_.push_back(entry.first))) {
LOG_WARN("push back failed", K(ret));
ret_ = ret;
@ -244,6 +244,7 @@ int ObDTLIntermResultManager::create_interm_result_info(ObMemAttr &attr,
result_info->is_read_ = false;
result_info->trace_id_ = *ObCurTraceId::get_trace_id();
result_info->monitor_info_ = monitor_info;
result_info->tenant_id_ = attr.tenant_id_;
result_info_guard.set_result_info(*result_info);
}
if (OB_FAIL(ret)) {
@ -417,6 +418,11 @@ int ObDTLIntermResultManager::erase_tenant_interm_result_info(int64_t tenant_id)
}
}
}
if (eraser.expire_keys_.count() < 100) {
LOG_INFO("erase_tenant_interm_result_info", K(tenant_id), K(eraser.expire_keys_));
} else {
LOG_INFO("erase_tenant_interm_result_info", K(tenant_id), K(eraser.expire_keys_.count()));
}
}
return ret;
}

View File

@ -104,6 +104,7 @@ public:
int64_t dump_time_;
int64_t dump_cost_;
ObDTLIntermResultMonitorInfo monitor_info_;
uint64_t tenant_id_;
};
struct ObDTLIntermResultInfoGuard
@ -212,7 +213,7 @@ public:
int operator() (common::hash::HashMapPair<ObDTLIntermResultKey,
ObDTLIntermResultInfo *> &entry);
public:
bool tenant_id_;
uint64_t tenant_id_;
common::ObSEArray<ObDTLIntermResultKey, 64> expire_keys_;
int ret_;
};