diff --git a/src/storage/blocksstable/ob_tmp_file.cpp b/src/storage/blocksstable/ob_tmp_file.cpp index 513eca7b7..155ca4d2f 100644 --- a/src/storage/blocksstable/ob_tmp_file.cpp +++ b/src/storage/blocksstable/ob_tmp_file.cpp @@ -1159,12 +1159,11 @@ ObTmpFileManager &ObTmpFileManager::get_instance() int ObTmpFileManager::init() { int ret = OB_SUCCESS; + ObMemAttr attr = SET_USE_500(ObMemAttr(OB_SERVER_TENANT_ID, ObModIds::OB_TMP_FILE_MANAGER)); //TODO: split tmp file map into each tenant. if (IS_INIT) { ret = OB_INIT_TWICE; STORAGE_LOG(WARN, "ObTmpFileManager has not been inited", K(ret)); - } else if (OB_FAIL(files_.init(DEFAULT_BUCKET_NUM, OB_SERVER_TENANT_ID, - ObModIds::OB_TMP_FILE_MANAGER, - TOTAL_LIMIT, HOLD_LIMIT, BLOCK_SIZE))) { + } else if (OB_FAIL(files_.init(DEFAULT_BUCKET_NUM, attr, TOTAL_LIMIT, HOLD_LIMIT, BLOCK_SIZE))) { STORAGE_LOG(WARN, "fail to init map for temporary files", K(ret)); } else if (OB_FAIL(OB_TMP_FILE_STORE.init())) { STORAGE_LOG(WARN, "fail to init the block manager for temporary files", K(ret)); diff --git a/src/storage/blocksstable/ob_tmp_file_store.cpp b/src/storage/blocksstable/ob_tmp_file_store.cpp index b907f01dd..43ccafb47 100644 --- a/src/storage/blocksstable/ob_tmp_file_store.cpp +++ b/src/storage/blocksstable/ob_tmp_file_store.cpp @@ -815,8 +815,6 @@ int64_t ObTmpTenantFileStore::dec_ref() int ObTmpTenantFileStore::init(const uint64_t tenant_id) { - auto allocator_attr = SET_USE_500(ObModIds::OB_TMP_BLOCK_MANAGER); - auto io_allocator_attr = SET_USE_500(ObModIds::OB_TMP_PAGE_CACHE); int ret = OB_SUCCESS; if (IS_INIT) { ret = OB_INIT_TWICE; @@ -825,8 +823,6 @@ int ObTmpTenantFileStore::init(const uint64_t tenant_id) STORAGE_LOG(WARN, "fail to init allocator", K(ret)); } else if (OB_FAIL(io_allocator_.init(OB_MALLOC_BIG_BLOCK_SIZE, ObModIds::OB_TMP_PAGE_CACHE, tenant_id, IO_LIMIT))) { STORAGE_LOG(WARN, "Fail to init io allocator, ", K(ret)); - } else if (FALSE_IT(allocator_.set_attr(allocator_attr))) { - } else if (FALSE_IT(io_allocator_.set_attr(io_allocator_attr))) { } else if (OB_ISNULL(page_cache_ = &ObTmpPageCache::get_instance())) { ret = OB_ERR_UNEXPECTED; STORAGE_LOG(WARN, "fail to get the page cache", K(ret)); diff --git a/src/storage/meta_mem/ob_tenant_meta_mem_mgr.cpp b/src/storage/meta_mem/ob_tenant_meta_mem_mgr.cpp index b0bf509aa..d1ed82847 100644 --- a/src/storage/meta_mem/ob_tenant_meta_mem_mgr.cpp +++ b/src/storage/meta_mem/ob_tenant_meta_mem_mgr.cpp @@ -135,6 +135,7 @@ int ObTenantMetaMemMgr::init() { int ret = OB_SUCCESS; lib::ObMemAttr mem_attr(tenant_id_, "MetaAllocator", ObCtxIds::META_OBJ_CTX_ID); + lib::ObMemAttr map_attr(tenant_id_, "TabletMap"); lib::ObMemAttr other_attr(tenant_id_, "T3MOtherMem"); const int64_t bucket_num = cal_adaptive_bucket_num(); const int64_t pin_set_bucket_num = common::hash::cal_next_prime(DEFAULT_BUCKET_NUM); @@ -147,7 +148,7 @@ int ObTenantMetaMemMgr::init() } else if (OB_FAIL(allocator_.init(lib::ObMallocAllocator::get_instance(), OB_MALLOC_NORMAL_BLOCK_SIZE, mem_attr))) { LOG_WARN("fail to init tenant fifo allocator", K(ret)); - } else if (OB_FAIL(tablet_map_.init(bucket_num, tenant_id_, "TabletMap", TOTAL_LIMIT, HOLD_LIMIT, + } else if (OB_FAIL(tablet_map_.init(bucket_num, map_attr, TOTAL_LIMIT, HOLD_LIMIT, common::OB_MALLOC_NORMAL_BLOCK_SIZE))) { LOG_WARN("fail to initialize tablet map", K(ret), K(bucket_num)); } else if (OB_FAIL(last_min_minor_sstable_set_.create(DEFAULT_MINOR_SSTABLE_SET_COUNT, other_attr))) { diff --git a/src/storage/ob_resource_map.h b/src/storage/ob_resource_map.h index f0a429a56..11286683c 100644 --- a/src/storage/ob_resource_map.h +++ b/src/storage/ob_resource_map.h @@ -160,7 +160,7 @@ class ObResourceMap public: ObResourceMap(); virtual ~ObResourceMap(); - int init(const int64_t bucket_num, const uint64_t tenant_id, const char *label, + int init(const int64_t bucket_num, const ObMemAttr &attr, const int64_t total_limit, const int64_t hold_limit, const int64_t page_size); template > int get(const Key &key, ObResourceHandle &handle, Callback callback = ObResourceDefaultCallback()); @@ -205,14 +205,13 @@ ObResourceMap::~ObResourceMap() template int ObResourceMap::init( const int64_t bucket_num, - const uint64_t tenant_id, - const char *label, + const ObMemAttr &attr, const int64_t total_limit, const int64_t hold_limit, const int64_t page_size) { int ret = common::OB_SUCCESS; - ObMemAttr attr = SET_USE_500(ObMemAttr(tenant_id, label)); + const uint64_t tenant_id = attr.tenant_id_; const int64_t bkt_num = common::hash::cal_next_prime(bucket_num); if (OB_UNLIKELY(is_inited_)) { ret = common::OB_INIT_TWICE; @@ -235,7 +234,7 @@ int ObResourceMap::init( } else { allocator_.set_attr(attr); is_inited_ = true; - STORAGE_LOG(INFO, "init resource map success", K(ret), K(tenant_id), K(bkt_num)); + STORAGE_LOG(INFO, "init resource map success", K(ret), K(attr), K(bkt_num)); } return ret; } diff --git a/unittest/storage/test_meta_pointer_map.cpp b/unittest/storage/test_meta_pointer_map.cpp index bfcafbb44..d6e83764d 100644 --- a/unittest/storage/test_meta_pointer_map.cpp +++ b/unittest/storage/test_meta_pointer_map.cpp @@ -72,8 +72,8 @@ TestMetaPointerMap::TestMetaPointerMap() void TestMetaPointerMap::SetUp() { - int ret = tablet_map_.init(1000L, OB_SERVER_TENANT_ID, - "TabletMap", 15 * 1024L * 1024L * 1024L, 8 * 1024L * 1024L, + lib::ObMemAttr attr(OB_SERVER_TENANT_ID, "TabletMap"); + int ret = tablet_map_.init(1000L, attr, 15 * 1024L * 1024L * 1024L, 8 * 1024L * 1024L, common::OB_MALLOC_NORMAL_BLOCK_SIZE); ASSERT_EQ(common::OB_SUCCESS, ret);