fix failed to print deleted_tenant with kill -62
This commit is contained in:
24
deps/oblib/src/lib/alloc/memory_dump.cpp
vendored
24
deps/oblib/src/lib/alloc/memory_dump.cpp
vendored
@ -613,11 +613,31 @@ void ObMemoryDump::handle(void *task)
|
||||
// chunk
|
||||
int cnt = 0;
|
||||
if (m_task->dump_all_) {
|
||||
ret = ObMallocAllocator::get_instance()->get_chunks(chunks_, MAX_CHUNK_CNT, cnt);
|
||||
int tenant_cnt = 0;
|
||||
get_tenant_ids(tenant_ids_, MAX_TENANT_CNT, tenant_cnt);
|
||||
std::sort(tenant_ids_, tenant_ids_ + tenant_cnt);
|
||||
for (int tenant_idx = 0; tenant_idx < tenant_cnt; tenant_idx++) {
|
||||
uint64_t tenant_id = tenant_ids_[tenant_idx];
|
||||
for (int ctx_id = 0; ctx_id < ObCtxIds::MAX_CTX_ID; ctx_id++) {
|
||||
auto ta =
|
||||
ObMallocAllocator::get_instance()->get_tenant_ctx_allocator(tenant_id, ctx_id);
|
||||
if (nullptr == ta) {
|
||||
ta = ObMallocAllocator::get_instance()->get_tenant_ctx_allocator_unrecycled(tenant_id,
|
||||
ctx_id);
|
||||
}
|
||||
if (nullptr != ta) {
|
||||
ta->get_chunks(chunks_, MAX_CHUNK_CNT, cnt);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (m_task->dump_tenant_ctx_) {
|
||||
auto ta = ObMallocAllocator::get_instance()->get_tenant_ctx_allocator(m_task->tenant_id_,
|
||||
m_task->ctx_id_);
|
||||
if (ta != nullptr) {
|
||||
if (nullptr == ta) {
|
||||
ta = ObMallocAllocator::get_instance()->get_tenant_ctx_allocator_unrecycled(m_task->tenant_id_,
|
||||
m_task->ctx_id_);
|
||||
}
|
||||
if (nullptr != ta) {
|
||||
ta->get_chunks(chunks_, MAX_CHUNK_CNT, cnt);
|
||||
}
|
||||
} else {
|
||||
|
||||
32
deps/oblib/src/lib/alloc/ob_malloc_allocator.cpp
vendored
32
deps/oblib/src/lib/alloc/ob_malloc_allocator.cpp
vendored
@ -539,38 +539,6 @@ int ObMallocAllocator::set_tenant_ctx_idle(const uint64_t tenant_id,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObMallocAllocator::get_chunks(AChunk **chunks, int cap, int &cnt)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObDisableDiagnoseGuard disable_diagnose_guard;
|
||||
for (int64_t slot = 0; OB_SUCC(ret) && slot < PRESERVED_TENANT_COUNT; ++slot) {
|
||||
ObTenantCtxAllocatorGuard tas[16]; // TODO: should be dynamic array, but enough so far
|
||||
int tas_cnt = 0;
|
||||
{
|
||||
BucketRLockGuard guard(locks_[slot], GETTID() % BucketLock::BUCKET_COUNT);
|
||||
ObTenantCtxAllocator *ta = allocators_[slot];
|
||||
while (OB_SUCC(ret) && ta != nullptr && tas_cnt < ARRAYSIZEOF(tas)) {
|
||||
tas[tas_cnt++] = ObTenantCtxAllocatorGuard(ta);
|
||||
ta = ta->get_next();
|
||||
}
|
||||
if (tas_cnt >= ARRAYSIZEOF(tas)) {
|
||||
LOG_WARN("array size not enough");
|
||||
// ignore ret
|
||||
}
|
||||
}
|
||||
while (OB_SUCC(ret) && tas_cnt--) {
|
||||
auto ta = tas[tas_cnt].ref_allocator();
|
||||
for (int64_t ctx_id = 0; OB_SUCC(ret) &&ctx_id < ObCtxIds::MAX_CTX_ID; ctx_id++) {
|
||||
ta[ctx_id].get_chunks(chunks, cap, cnt);
|
||||
if (cnt >= cap) {
|
||||
ret = OB_SIZE_OVERFLOW;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t ObMallocAllocator::sync_wash(uint64_t tenant_id, uint64_t from_ctx_id, int64_t wash_size)
|
||||
{
|
||||
int64_t washed_size = 0;
|
||||
|
||||
@ -133,7 +133,6 @@ public:
|
||||
void print_tenant_memory_usage(uint64_t tenant_id) const;
|
||||
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);
|
||||
int64_t sync_wash(uint64_t tenant_id, uint64_t from_ctx_id, int64_t wash_size);
|
||||
int64_t sync_wash();
|
||||
int recycle_tenant_allocator(uint64_t tenant_id);
|
||||
|
||||
Reference in New Issue
Block a user