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

@ -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<hash::HashMapPair<ObDiskUsageReportKey, int64_t>> result_arr;
ObFunction<int(const hash::HashMapPair<ObDiskUsageReportKey, int64_t> &pair)> copy_result =
[&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;
};
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));
}