Remove auto and lambda

This commit is contained in:
Tyshawn
2023-11-03 11:09:30 +00:00
committed by ob-robot
parent 6b98c50039
commit 88c00b6161
3 changed files with 24 additions and 13 deletions

View File

@ -743,7 +743,7 @@ ObTmpTenantMacroBlockManager::~ObTmpTenantMacroBlockManager()
int ObTmpTenantMacroBlockManager::init(common::ObIAllocator &allocator) int ObTmpTenantMacroBlockManager::init(common::ObIAllocator &allocator)
{ {
int ret = OB_SUCCESS; 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) { if (IS_INIT) {
ret = OB_INIT_TWICE; ret = OB_INIT_TWICE;
STORAGE_LOG(WARN, "ObTmpMacroBlockManager has been inited", K(ret)); STORAGE_LOG(WARN, "ObTmpMacroBlockManager has been inited", K(ret));
@ -1564,7 +1564,7 @@ ObTmpFileStore::~ObTmpFileStore()
int ObTmpFileStore::init() int ObTmpFileStore::init()
{ {
int ret = OB_SUCCESS; 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) { if (IS_INIT) {
ret = OB_INIT_TWICE; ret = OB_INIT_TWICE;
STORAGE_LOG(WARN, "ObTmpFileStore has not been inited", K(ret)); STORAGE_LOG(WARN, "ObTmpFileStore has not been inited", K(ret));

View File

@ -154,20 +154,10 @@ int ObDiskUsageReportTask::report_tenant_disk_usage(const char *svr_ip,
// to reduce the locking time of the result_map_, // to reduce the locking time of the result_map_,
// copy the value to array and then update the usage table, // copy the value to array and then update the usage table,
ObArray<hash::HashMapPair<ObDiskUsageReportKey, int64_t>> result_arr; ObArray<hash::HashMapPair<ObDiskUsageReportKey, int64_t>> result_arr;
ObFunction<int(const hash::HashMapPair<ObDiskUsageReportKey, int64_t> &pair)> copy_result = ObReportResultGetter copy_result(result_arr);
[&result_arr](const hash::HashMapPair<ObDiskUsageReportKey, int64_t> &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;
};
if (OB_FAIL(ret)) { if (OB_FAIL(ret)) {
// do nothing // 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))) { } else if (OB_FAIL(result_map_.foreach_refactored(copy_result))) {
STORAGE_LOG(WARN, "fail to copy result", K(ret)); STORAGE_LOG(WARN, "fail to copy result", K(ret));
} }

View File

@ -69,6 +69,27 @@ public:
int get_data_disk_used_size(const uint64_t tenant_id, int64_t &used_size) const; 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; int get_clog_disk_used_size(const uint64_t tenant_id, int64_t &used_size) const;
private:
class ObReportResultGetter final
{
public:
explicit ObReportResultGetter(ObArray<hash::HashMapPair<ObDiskUsageReportKey, int64_t>> &result_arr)
: result_arr_(result_arr)
{}
~ObReportResultGetter() = default;
int operator()(const hash::HashMapPair<ObDiskUsageReportKey, int64_t> &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<hash::HashMapPair<ObDiskUsageReportKey, int64_t>> &result_arr_;
DISALLOW_COPY_AND_ASSIGN(ObReportResultGetter);
};
private: private:
int report_tenant_disk_usage(const char *svr_ip, const int32_t svr_port, const int64_t seq_num); int report_tenant_disk_usage(const char *svr_ip, const int32_t svr_port, const int64_t seq_num);
int refresh_tenant_disk_usage(); int refresh_tenant_disk_usage();