[CP] add diagnose for LfFIFO

This commit is contained in:
nroskill 2024-04-30 08:45:15 +00:00 committed by ob-robot
parent 037155cd19
commit cc09840d51
2 changed files with 5 additions and 18 deletions

View File

@ -53,7 +53,6 @@ public:
mattr_.tenant_id_ = tenant_id;
return init(page_size, mattr_, cache_page_count, total_limit);
}
void destroy() { ObVSliceAlloc::purge_extra_cached_block(0); }
public:
void *alloc(const int64_t size) { return ObVSliceAlloc::alloc(size); }
void *alloc(const int64_t size, const ObMemAttr &attr) { UNUSED(attr); return alloc(size); }

View File

@ -100,22 +100,7 @@ public:
return ret;
}
void destroy() {
for(int i = MAX_ARENA_NUM - 1; i >= 0; i--) {
Arena& arena = arena_[i];
Block* old_blk = arena.clear();
if (NULL != old_blk) {
int64_t old_pos = INT64_MAX;
if (old_blk->freeze(old_pos)) {
arena.sync();
if (old_blk->retire(old_pos)) {
destroy_block(old_blk);
} else {
// can not monitor all leak !!!
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "there was memory leak", K(old_blk->ref_));
}
}
}
}
purge_extra_cached_block(0, true);
bsize_ = 0;
}
void set_nway(int nway) {
@ -225,7 +210,7 @@ public:
#endif
}
void purge_extra_cached_block(int keep) {
void purge_extra_cached_block(int keep, bool need_check = false) {
for(int i = MAX_ARENA_NUM - 1; i >= keep; i--) {
Arena& arena = arena_[i];
arena.ref(1);
@ -237,6 +222,9 @@ public:
arena.sync();
if (old_blk->retire(old_pos)) {
destroy_block(old_blk);
} else if (need_check) {
// can not monitor all leak !!!
LIB_LOG_RET(ERROR, common::OB_ERR_UNEXPECTED, "there was memory leak", K(old_blk->ref_));
}
} else {
arena.ref(-1);