Add defensive log in ObGMemstoreAllocator::alloc

This commit is contained in:
obdev
2023-02-07 00:24:14 +08:00
committed by ob-robot
parent 780c8a8331
commit 961c74791e
2 changed files with 4 additions and 1 deletions

View File

@ -98,7 +98,9 @@ void* ObGMemstoreAllocator::alloc(AllocHandle& handle, int64_t size)
if (!handle.is_id_valid()) {
COMMON_LOG(TRACE, "MTALLOC.first_alloc", KP(&handle.mt_));
LockGuard guard(lock_);
if (!handle.is_id_valid()) {
if (handle.is_frozen()) {
COMMON_LOG(ERROR, "cannot alloc because allocator is frozen", K(ret), K(handle.mt_));
} else if (!handle.is_id_valid()) {
handle.set_clock(arena_.retired());
hlist_.set_active(handle);
}

View File

@ -116,6 +116,7 @@ public:
}
void set_frozen() { ATOMIC_STORE(&freeze_stat_, FROZEN); }
bool is_active() const { return ATOMIC_LOAD(&freeze_stat_) == ACTIVE; }
bool is_frozen() const { return ATOMIC_LOAD(&freeze_stat_) == FROZEN; }
TO_STRING_KV(K_(freeze_stat), K_(id), K_(clock));
};
ObHandleList(): id_(0), hazard_(INT64_MAX), total_count_(0) {