[CP] print MEMORY LOG when tenant deleted but memory not freed
This commit is contained in:
parent
97b7209e61
commit
145a4a87a6
@ -569,12 +569,19 @@ int ObMultiTenant::create_tenant_without_unit(const uint64_t tenant_id,
|
||||
static const int64_t VIRTUAL_TENANT_MEMORY_LIMTI = 1L << 30;
|
||||
mem_limit = VIRTUAL_TENANT_MEMORY_LIMTI;
|
||||
}
|
||||
|
||||
if (OB_FAIL(construct_meta_for_virtual_tenant(tenant_id, min_cpu, max_cpu, mem_limit, meta))) {
|
||||
LOG_WARN("fail to construct_meta_for_virtual_tenant", K(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(create_tenant(meta, false))) {
|
||||
LOG_WARN("fail to create virtual tenant", K(ret), K(tenant_id));
|
||||
}
|
||||
if (OB_SUCC(ret) && is_virtual_tenant_id(tenant_id)) {
|
||||
ObVirtualTenantManager &omti = ObVirtualTenantManager::get_instance();
|
||||
if (OB_FAIL(omti.add_tenant(tenant_id))) {
|
||||
LOG_ERROR("Fail to add virtual tenant to tenant manager, ", K(ret));
|
||||
} else if (OB_FAIL(omti.set_tenant_mem_limit(tenant_id, 0, mem_limit))) {
|
||||
LOG_ERROR("Fail to set virtual tenant mem limit, ", K(ret));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#define USING_LOG_PREFIX STORAGE
|
||||
|
||||
#include "lib/utility/ob_print_utils.h"
|
||||
#include "lib/alloc/memory_dump.h"
|
||||
#include "observer/omt/ob_multi_tenant.h" // ObMultiTenant
|
||||
#include "share/ob_tenant_mgr.h" // get_virtual_memory_used
|
||||
#include "share/allocator/ob_memstore_allocator_mgr.h" // ObMemstoreAllocatorMgr
|
||||
@ -90,6 +91,28 @@ int ObTenantMemoryPrinter::print_tenant_usage()
|
||||
LOG_WARN("print mtl tenant usage failed", K(tmp_ret), K(tenant_id));
|
||||
}
|
||||
}
|
||||
static int64_t last_print_ts = 0;
|
||||
const int64_t now = ObTimeUtility::current_time();
|
||||
const int64_t INTERVAL = 10 * 60 * 1000000L;
|
||||
if (now - last_print_ts >= INTERVAL) {
|
||||
omt::TenantIdList current_ids(nullptr, ObModIds::OMT);
|
||||
omt->get_tenant_ids(current_ids);
|
||||
int tenant_cnt = 0;
|
||||
static uint64_t all_tenant_ids[OB_MAX_SERVER_TENANT_CNT] = {0};
|
||||
common::get_tenant_ids(all_tenant_ids, OB_MAX_SERVER_TENANT_CNT, tenant_cnt);
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < tenant_cnt; ++i) {
|
||||
uint64_t id = all_tenant_ids[i];
|
||||
if (OB_SERVER_TENANT_ID != id && current_ids.find(id) == current_ids.end()) {
|
||||
// id is deleted tenant
|
||||
lib::ObMallocAllocator *mallocator = lib::ObMallocAllocator::get_instance();
|
||||
if (OB_NOT_NULL(mallocator)) {
|
||||
mallocator->print_tenant_memory_usage(id);
|
||||
mallocator->print_tenant_ctx_memory_usage(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
last_print_ts = now;
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SIZE_OVERFLOW == ret) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user