diff --git a/be/src/pipeline/exec/olap_scan_operator.cpp b/be/src/pipeline/exec/olap_scan_operator.cpp index b1ab62743323c6..6fc65bbbbe8830 100644 --- a/be/src/pipeline/exec/olap_scan_operator.cpp +++ b/be/src/pipeline/exec/olap_scan_operator.cpp @@ -322,15 +322,17 @@ Status OlapScanLocalState::_init_scanners(std::list* s if (config::is_cloud_mode()) { int64_t duration_ns = 0; - SCOPED_RAW_TIMER(&duration_ns); - std::vector> tasks; - tasks.reserve(_scan_ranges.size()); - for (auto&& [tablet, version] : tablets) { - tasks.emplace_back([tablet, version]() { - return std::dynamic_pointer_cast(tablet)->sync_rowsets(version); - }); + { + SCOPED_RAW_TIMER(&duration_ns); + std::vector> tasks; + tasks.reserve(_scan_ranges.size()); + for (auto&& [tablet, version] : tablets) { + tasks.emplace_back([tablet, version]() { + return std::dynamic_pointer_cast(tablet)->sync_rowsets(version); + }); + } + RETURN_IF_ERROR(cloud::bthread_fork_join(tasks, 10)); } - RETURN_IF_ERROR(cloud::bthread_fork_join(tasks, 10)); _sync_rowset_timer->update(duration_ns); }