use mtl_id to init some structures

This commit is contained in:
obdev
2023-06-14 13:42:12 +00:00
committed by ob-robot
parent 5d2561245b
commit 7095e40b8b
4 changed files with 14 additions and 7 deletions

View File

@ -779,7 +779,10 @@ void MockTenantModuleEnv::destroy()
ObServerCheckpointSlogHandler::get_instance().destroy();
SLOGGERMGR.destroy();
THE_IO_DEVICE->destroy();
OB_SERVER_BLOCK_MGR.stop();
OB_SERVER_BLOCK_MGR.wait();
OB_SERVER_BLOCK_MGR.destroy();
ObTsMgr::get_instance().stop();
ObTsMgr::get_instance().wait();
@ -798,6 +801,8 @@ void MockTenantModuleEnv::destroy()
TG_WAIT(lib::TGDefIDs::MemDumpTimer);
TG_DESTROY(lib::TGDefIDs::MemDumpTimer);
THE_IO_DEVICE->destroy();
destroyed_ = true;

View File

@ -1948,6 +1948,8 @@ void ObT3mTabletMapIterator::reset()
int ObT3mTabletMapIterator::fetch_tablet_item()
{
int ret = OB_SUCCESS;
ObMemAttr attr = SET_USE_500(ObMemAttr(MTL_ID(), "TabletIterSE"));
tablet_items_.set_attr(attr);
FetchTabletItemOp fetch_op(tablet_map_, tablet_items_);
if (OB_UNLIKELY(tablet_items_.count() > 0)) {
ret = OB_ERR_UNEXPECTED;

View File

@ -201,10 +201,6 @@ int ObDiskUsageReportTask::report_tenant_disk_usage(const char *svr_ip,
int ObDiskUsageReportTask::count_tenant_data(const uint64_t tenant_id)
{
int ret = OB_SUCCESS;
if (OB_NOT_NULL(tablet_iter_)) {
tablet_iter_->~ObTenantTabletIterator();
tablet_iter_ = nullptr;
}
ObTenantMetaMemMgr *t3m = MTL(ObTenantMetaMemMgr*);
tablet_iter_ = new (iter_buf_) ObTenantTabletIterator(*t3m, allocator_);
ObTabletHandle tablet_handle;
@ -238,6 +234,10 @@ int ObDiskUsageReportTask::count_tenant_data(const uint64_t tenant_id)
}
}
if (OB_NOT_NULL(tablet_iter_)) {
tablet_iter_->~ObTenantTabletIterator();
tablet_iter_ = nullptr;
}
return ret;
}

View File

@ -212,7 +212,7 @@ int ObResourceMap<Key, Value>::init(
const int64_t page_size)
{
int ret = common::OB_SUCCESS;
auto attr = SET_USE_500(ObMemAttr(tenant_id, label));
ObMemAttr attr = SET_USE_500(ObMemAttr(tenant_id, label));
const int64_t bkt_num = common::hash::cal_next_prime(bucket_num);
if (OB_UNLIKELY(is_inited_)) {
ret = common::OB_INIT_TWICE;
@ -230,7 +230,7 @@ int ObResourceMap<Key, Value>::init(
ret = OB_ERR_UNEXPECTED;
STORAGE_LOG(WARN, "lock buckets isn't equal to map buckets, which could cause concurrency issues", K(ret),
K(bkt_num), K(map_.bucket_count()));
} else if (OB_FAIL(allocator_.init(total_limit, hold_limit, page_size))) {
} else if (OB_FAIL(allocator_.init(page_size, "ResourceMap", tenant_id, total_limit))) {
STORAGE_LOG(WARN, "fail to init allocator", K(ret));
} else {
allocator_.set_attr(attr);