This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 106314740cf branch-4.0: [refactor](scan) extract scanner profile
update logic and update on eos #60615 (#61039)
106314740cf is described below
commit 106314740cf1f4ecb9f22fcc17cf95c185313e7b
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Mar 5 09:59:01 2026 +0800
branch-4.0: [refactor](scan) extract scanner profile update logic and
update on eos #60615 (#61039)
Cherry-picked from #60615
Co-authored-by: Pxl <[email protected]>
---
be/src/vec/exec/scan/scanner_scheduler.cpp | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/be/src/vec/exec/scan/scanner_scheduler.cpp
b/be/src/vec/exec/scan/scanner_scheduler.cpp
index 779f5fc1497..fcbf265c3b3 100644
--- a/be/src/vec/exec/scan/scanner_scheduler.cpp
+++ b/be/src/vec/exec/scan/scanner_scheduler.cpp
@@ -157,17 +157,22 @@ void
ScannerScheduler::_scanner_scan(std::shared_ptr<ScannerContext> ctx,
max_run_time_watch.start();
scanner->update_wait_worker_timer();
scanner->start_scan_cpu_timer();
- Defer defer_scanner(
- [&] { // WorkloadGroup Policy will check cputime realtime, so that
should update the counter
- // as soon as possible, could not update it on close.
- if (scanner->has_prepared()) {
- // Counter update need prepare successfully, or it maybe
core. For example, olap scanner
- // will open tablet reader during prepare, if not prepare
successfully, tablet reader == nullptr.
- scanner->update_scan_cpu_timer();
- scanner->update_realtime_counters();
- scanner->start_wait_worker_timer();
- }
- });
+
+ // Counter update need prepare successfully, or it maybe core. For
example, olap scanner
+ // will open tablet reader during prepare, if not prepare successfully,
tablet reader == nullptr.
+ bool need_update_profile = scanner->has_prepared();
+ auto update_scanner_profile = [&]() {
+ if (need_update_profile) {
+ scanner->update_scan_cpu_timer();
+ scanner->update_realtime_counters();
+ need_update_profile = false;
+ }
+ };
+ Defer defer_scanner([&] {
+ // WorkloadGroup Policy will check cputime realtime, so that should
update the counter
+ // as soon as possible, could not update it on close.
+ update_scanner_profile();
+ });
Status status = Status::OK();
bool eos = false;
ASSIGN_STATUS_IF_CATCH_EXCEPTION(
@@ -326,6 +331,9 @@ void
ScannerScheduler::_scanner_scan(std::shared_ptr<ScannerContext> ctx,
}
if (eos) {
+ // If eos, scanner will call _collect_profile_before_close to update
profile,
+ // so we need update_scanner_profile here
+ update_scanner_profile();
scanner->mark_to_need_to_close();
}
scan_task->set_eos(eos);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]