Fix a batch of memory not being split to tenant

This commit is contained in:
obdev
2023-05-18 14:11:18 +00:00
committed by ob-robot
parent 135383ca8b
commit 10ebab170d
98 changed files with 284 additions and 174 deletions

View File

@ -334,7 +334,7 @@ int ObExecContext::get_temp_expr_eval_ctx(const ObTempExpr &temp_expr,
int ret = OB_SUCCESS;
if (use_temp_expr_ctx_cache_) {
if (!temp_expr_ctx_map_.created()) {
OZ(temp_expr_ctx_map_.create(8, ObLabel("TempExprCtx")));
OZ(temp_expr_ctx_map_.create(8, ObMemAttr(OB_SERVER_TENANT_ID, "TempExprCtx")));
}
if (OB_SUCC(ret)) {
int64_t ctx_ptr = 0;

View File

@ -1129,9 +1129,10 @@ const common::hash::ObHashMap<ObAddr, int64_t>& ObPhysicalPlan::get_minimal_work
int ObPhysicalPlan::assign_worker_map(common::hash::ObHashMap<ObAddr, int64_t> &worker_map, const common::hash::ObHashMap<ObAddr, int64_t> &c)
{
int ret = OB_SUCCESS;
ObMemAttr attr(MTL_ID(), "WorkerMap");
if (worker_map.created()) {
worker_map.clear();
} else if (OB_FAIL(worker_map.create(common::hash::cal_next_prime(100), ObModIds::OB_SQL_PX, ObModIds::OB_SQL_PX))){
} else if (OB_FAIL(worker_map.create(common::hash::cal_next_prime(100), attr, attr))){
LOG_WARN("create hash map failed", K(ret));
}
if (OB_SUCC(ret)) {

View File

@ -331,14 +331,15 @@ int ObTenantSqlMemoryManager::mtl_init(ObTenantSqlMemoryManager *&sql_mem_mgr)
sql_mem_mgr = nullptr;
// 系统租户不创建
if (OB_MAX_RESERVED_TENANT_ID < tenant_id) {
sql_mem_mgr = OB_NEW(ObTenantSqlMemoryManager, "SqlMemMgr", tenant_id);
sql_mem_mgr = OB_NEW(ObTenantSqlMemoryManager,
ObMemAttr(tenant_id, "SqlMemMgr"), tenant_id);
if (nullptr == sql_mem_mgr) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("failed to alloc tenant sql memory manager", K(ret));
} else if (OB_FAIL(sql_mem_mgr->allocator_.init(
lib::ObMallocAllocator::get_instance(),
OB_MALLOC_NORMAL_BLOCK_SIZE,
ObMemAttr(common::OB_SERVER_TENANT_ID, "SqlMemMgr")))) {
ObMemAttr(tenant_id, "SqlMemMgr")))) {
LOG_WARN("failed to init fifo allocator", K(ret));
} else {
int64_t work_area_interval_size = sizeof(ObSqlWorkAreaInterval) * INTERVAL_NUM;