memory diagnose including deleted tenant

This commit is contained in:
nroskill
2021-08-18 10:16:22 +08:00
committed by wangzelin.wzl
parent 4791a7335e
commit 94e2cc67b4
3 changed files with 10 additions and 25 deletions

View File

@ -25,6 +25,7 @@ using namespace oceanbase::lib;
using namespace oceanbase::common;
ObMallocAllocator* ObMallocAllocator::instance_ = NULL;
uint64_t ObMallocAllocator::max_used_tenant_id_ = 0;
ObMallocAllocator::ObMallocAllocator() : locks_(), allocators_(), reserved_(0), urgent_(0)
{}
@ -206,6 +207,9 @@ ObTenantCtxAllocator* ObMallocAllocator::get_tenant_ctx_allocator(uint64_t tenan
int ObMallocAllocator::create_tenant_ctx_allocator(uint64_t tenant_id, uint64_t ctx_id)
{
int ret = OB_SUCCESS;
if (tenant_id > max_used_tenant_id_) {
UNUSED(ATOMIC_BCAS(&max_used_tenant_id_, max_used_tenant_id_, tenant_id));
}
if (INT64_MAX == tenant_id) {
ret = OB_INVALID_ARGUMENT;
LOG_ERROR("invalid argument", K(lbt()), K(tenant_id), K(ret));

View File

@ -66,7 +66,7 @@ public:
int set_tenant_ctx_idle(
const uint64_t tenant_id, const uint64_t ctx_id, const int64_t size, const bool reserve = false);
int get_chunks(AChunk** chunks, int cap, int& cnt);
static uint64_t get_max_used_tenant_id() { return max_used_tenant_id_; }
private:
using InvokeFunc = std::function<int(ObTenantMemoryMgr*)>;
static int with_resource_handle_invoke(uint64_t tenant_id, InvokeFunc func);
@ -79,6 +79,7 @@ private:
ObTenantCtxAllocator* allocators_[PRESERVED_TENANT_COUNT][common::ObCtxIds::MAX_CTX_ID];
int64_t reserved_;
int64_t urgent_;
static uint64_t max_used_tenant_id_;
static ObMallocAllocator* instance_;
}; // end of class ObMallocAllocator