diff --git a/src/storage/blocksstable/ob_tmp_file_store.cpp b/src/storage/blocksstable/ob_tmp_file_store.cpp index 81bfb2ff6b..357a804784 100644 --- a/src/storage/blocksstable/ob_tmp_file_store.cpp +++ b/src/storage/blocksstable/ob_tmp_file_store.cpp @@ -743,7 +743,7 @@ ObTmpTenantMacroBlockManager::~ObTmpTenantMacroBlockManager() int ObTmpTenantMacroBlockManager::init(common::ObIAllocator &allocator) { int ret = OB_SUCCESS; - auto attr = SET_USE_500(ObModIds::OB_TMP_BLOCK_MAP); + ObMemAttr attr = SET_USE_500(ObModIds::OB_TMP_BLOCK_MAP); if (IS_INIT) { ret = OB_INIT_TWICE; STORAGE_LOG(WARN, "ObTmpMacroBlockManager has been inited", K(ret)); @@ -1564,7 +1564,7 @@ ObTmpFileStore::~ObTmpFileStore() int ObTmpFileStore::init() { int ret = OB_SUCCESS; - auto attr = SET_USE_500(ObModIds::OB_TMP_FILE_STORE_MAP); + ObMemAttr attr = SET_USE_500(ObModIds::OB_TMP_FILE_STORE_MAP); if (IS_INIT) { ret = OB_INIT_TWICE; STORAGE_LOG(WARN, "ObTmpFileStore has not been inited", K(ret)); diff --git a/src/storage/ob_disk_usage_reporter.cpp b/src/storage/ob_disk_usage_reporter.cpp index 3cca29aac3..9661bb0de7 100644 --- a/src/storage/ob_disk_usage_reporter.cpp +++ b/src/storage/ob_disk_usage_reporter.cpp @@ -154,20 +154,10 @@ int ObDiskUsageReportTask::report_tenant_disk_usage(const char *svr_ip, // to reduce the locking time of the result_map_, // copy the value to array and then update the usage table, ObArray> result_arr; - ObFunction &pair)> copy_result = - [&result_arr](const hash::HashMapPair &pair) { - int ret = OB_SUCCESS; - if (OB_FAIL(result_arr.push_back(pair))) { - STORAGE_LOG(WARN, "failed to push back pair", K(ret)); - } - return ret; - }; + ObReportResultGetter copy_result(result_arr); if (OB_FAIL(ret)) { // do nothing - } else if (!copy_result.is_valid()) { - ret = OB_ERR_UNEXPECTED; - STORAGE_LOG(WARN, "copy_func invalid", K(ret)); } else if (OB_FAIL(result_map_.foreach_refactored(copy_result))) { STORAGE_LOG(WARN, "fail to copy result", K(ret)); } diff --git a/src/storage/ob_disk_usage_reporter.h b/src/storage/ob_disk_usage_reporter.h index ab2615ff3d..24980b4fc8 100644 --- a/src/storage/ob_disk_usage_reporter.h +++ b/src/storage/ob_disk_usage_reporter.h @@ -69,6 +69,27 @@ public: int get_data_disk_used_size(const uint64_t tenant_id, int64_t &used_size) const; int get_clog_disk_used_size(const uint64_t tenant_id, int64_t &used_size) const; +private: + class ObReportResultGetter final + { + public: + explicit ObReportResultGetter(ObArray> &result_arr) + : result_arr_(result_arr) + {} + ~ObReportResultGetter() = default; + int operator()(const hash::HashMapPair &pair) + { + int ret = OB_SUCCESS; + if (OB_FAIL(result_arr_.push_back(pair))) { + STORAGE_LOG(WARN, "failed to push back pair", K(ret)); + } + return ret; + } + private: + ObArray> &result_arr_; + DISALLOW_COPY_AND_ASSIGN(ObReportResultGetter); + }; + private: int report_tenant_disk_usage(const char *svr_ip, const int32_t svr_port, const int64_t seq_num); int refresh_tenant_disk_usage();