[CP] [BUG.FIX] Add _temporary_file_meta_memory_limit for tmp file

This commit is contained in:
Tyshawn
2023-11-20 08:46:45 +00:00
committed by ob-robot
parent d9ca3d13de
commit af9c216530
5 changed files with 57 additions and 33 deletions

View File

@ -1525,25 +1525,12 @@ int ObTmpTenantMemBlockManager::exec_wait()
int ObTmpTenantMemBlockManager::change_mem()
{
int ret = OB_SUCCESS;
uint64_t mem_limit = 0;
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(tenant_id_));
if (!tenant_config.is_valid()) {
COMMON_LOG(INFO, "failed to get tenant config", K_(tenant_id));
} else {
// Here, this memory is used to store temporary file block metadata, which is related to the
// datafile size. So, we set the upper limit of memory to be 70% of tenant memory to
// avoid excessive tenant memory, and affecting system stability. In theory, the limit
// will be reached only when the tenant's memory is extremely small and the disk is extremely
// large.
if (0 == tenant_config->_temporary_file_io_area_size) {
mem_limit = 2 * (2 << 20);
} else {
mem_limit = common::upper_align(
lib::get_tenant_memory_limit(tenant_id_) * 0.7, ObTmpFileStore::get_block_size());
}
allocator_->set_total_limit(mem_limit);
}
// Here, this memory is used to store temporary file block metadata, which is related to the
// datafile size. So, we set the upper limit of memory to be percentage (default, 70%) of tenant memory to
// avoid excessive tenant memory, and affecting system stability. In theory, the limit
// will be reached only when the tenant's memory is extremely small and the disk is extremely
// large.
tenant_store_.refresh_memory_limit(tenant_id_);
return ret;
}