gavinchou commented on code in PR #51701:
URL: https://github.com/apache/doris/pull/51701#discussion_r2158938321
##########
be/src/pipeline/exec/olap_scan_operator.cpp:
##########
@@ -446,107 +445,145 @@ Status
OlapScanLocalState::_init_scanners(std::list<vectorized::ScannerSPtr>* sc
return Status::OK();
}
-Status OlapScanLocalState::hold_tablets() {
+Status OlapScanLocalState::hold_tablets(RuntimeState* state) {
if (!_tablets.empty()) {
+ // In cloud mode, we should make sure none-or-all tablets are loaded
into cache.
+ DCHECK(!config::is_cloud_mode() ||
+ !std::any_of(
+ _cloud_tablet_dependencies.begin(),
_cloud_tablet_dependencies.end(),
+ [&](DependencySPtr dep) -> bool { return
dep->is_blocked_by(nullptr); }));
return Status::OK();
}
- MonotonicStopWatch timer;
- timer.start();
_tablets.resize(_scan_ranges.size());
_read_sources.resize(_scan_ranges.size());
if (config::is_cloud_mode()) {
- std::vector<SyncRowsetStats> sync_statistics(_scan_ranges.size());
- std::vector<std::function<Status()>> tasks {};
- tasks.reserve(_scan_ranges.size());
- int64_t duration_ns {0};
- {
- SCOPED_RAW_TIMER(&duration_ns);
- for (size_t i = 0; i < _scan_ranges.size(); i++) {
- auto* sync_stats = &sync_statistics[i];
- int64_t version = 0;
- std::from_chars(_scan_ranges[i]->version.data(),
+ /**
+ * In cloud-mode, cold tablet replica need to be read from remote
storage before execution. This
+ * behaviour will be harmful for pipeline execution due to its heavy
IO. So we shuold make sure
+ * it is separated from execution thread.
+ */
+ auto task_ctx = state->get_task_execution_context();
+ for (size_t i = 0; i < _scan_ranges.size(); i++) {
+
RETURN_IF_ERROR(ExecEnv::GetInstance()->fragment_mgr()->get_cloud_tablet_thread_pool()->submit_func(
+ [&, i, state, task_ctx]() {
Review Comment:
separate the lambda to a function, too long to read and to many indentions
##########
be/src/pipeline/exec/olap_scan_operator.cpp:
##########
@@ -446,107 +445,145 @@ Status
OlapScanLocalState::_init_scanners(std::list<vectorized::ScannerSPtr>* sc
return Status::OK();
}
-Status OlapScanLocalState::hold_tablets() {
+Status OlapScanLocalState::hold_tablets(RuntimeState* state) {
if (!_tablets.empty()) {
+ // In cloud mode, we should make sure none-or-all tablets are loaded
into cache.
+ DCHECK(!config::is_cloud_mode() ||
+ !std::any_of(
+ _cloud_tablet_dependencies.begin(),
_cloud_tablet_dependencies.end(),
+ [&](DependencySPtr dep) -> bool { return
dep->is_blocked_by(nullptr); }));
return Status::OK();
}
- MonotonicStopWatch timer;
- timer.start();
_tablets.resize(_scan_ranges.size());
_read_sources.resize(_scan_ranges.size());
if (config::is_cloud_mode()) {
- std::vector<SyncRowsetStats> sync_statistics(_scan_ranges.size());
- std::vector<std::function<Status()>> tasks {};
- tasks.reserve(_scan_ranges.size());
- int64_t duration_ns {0};
- {
- SCOPED_RAW_TIMER(&duration_ns);
- for (size_t i = 0; i < _scan_ranges.size(); i++) {
- auto* sync_stats = &sync_statistics[i];
- int64_t version = 0;
- std::from_chars(_scan_ranges[i]->version.data(),
+ /**
+ * In cloud-mode, cold tablet replica need to be read from remote
storage before execution. This
+ * behaviour will be harmful for pipeline execution due to its heavy
IO. So we shuold make sure
+ * it is separated from execution thread.
+ */
+ auto task_ctx = state->get_task_execution_context();
+ for (size_t i = 0; i < _scan_ranges.size(); i++) {
+
RETURN_IF_ERROR(ExecEnv::GetInstance()->fragment_mgr()->get_cloud_tablet_thread_pool()->submit_func(
+ [&, i, state, task_ctx]() {
Review Comment:
separate the lambda to a function, too long to read and too many indentions
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]