[BUG.FIX] fix loop in ObTmpTenantMemBlockManager::check_memory_limit()

This commit is contained in:
Tyshawn 2023-08-07 12:18:34 +00:00 committed by ob-robot
parent 2d7760cb99
commit d5980a4134

View File

@ -1080,7 +1080,7 @@ int ObTmpTenantMemBlockManager::check_memory_limit()
{
int ret = OB_SUCCESS;
const int64_t timeout_ts = THIS_WORKER.get_timeout_ts();
while (OB_SUCC(ret) && get_tenant_mem_block_num() < t_mblk_map_.size()) {
while (OB_SUCC(ret) && get_tenant_mem_block_num() < t_mblk_map_.size() && !wait_info_queue_.is_empty()) {
ObThreadCondGuard guard(cond_);
if (OB_FAIL(guard.get_ret())) {
STORAGE_LOG(ERROR, "fail to guard request condition", K(ret));
@ -1130,6 +1130,7 @@ int ObTmpTenantMemBlockManager::cleanup()
ret = OB_NOT_INIT;
STORAGE_LOG(WARN, "ObTmpBlockCache has not been inited", K(ret));
} else if (OB_FAIL(check_memory_limit())) {
STORAGE_LOG(WARN, "fail to check memory limit", K(ret), K(t_mblk_map_.size()), K(get_tenant_mem_block_num()));
} else {
const int64_t wash_threshold = get_tenant_mem_block_num() * 0.8;
Heap heap(compare_, &allocator);
@ -1512,7 +1513,7 @@ int ObTmpTenantMemBlockManager::exec_wait()
if (OB_TMP_FAIL(cond_.broadcast())) {
STORAGE_LOG(ERROR, "signal wash condition failed", K(ret), K(tmp_ret));
}
if (loop_nums > 0) {
if (loop_nums > 0 || REACH_TIME_INTERVAL(1000 * 1000L)/*1s*/) {
const int64_t washing_count = ATOMIC_LOAD(&washing_count_);
int64_t block_cache_num = -1;
int64_t page_cache_num = -1;