Copilot commented on code in PR #62647:
URL: https://github.com/apache/doris/pull/62647#discussion_r3110950490


##########
be/src/vec/exec/scan/scanner_scheduler.cpp:
##########
@@ -177,6 +177,7 @@ void 
ScannerScheduler::_scanner_scan(std::shared_ptr<ScannerContext> ctx,
     Status status = Status::OK();
     bool eos = false;
     Defer defer_scanner([&] {
+        update_scanner_profile();
         if (status.ok() && !eos) {
             // if status is not ok, it means the scanner is failed, and the 
counter may be not updated correctly, so no need to update counter again. if 
eos is true, it means the scanner is finished successfully, and the counter is 
updated correctly, so no need to update counter again.

Review Comment:
   The inline comment under the `if (status.ok() && !eos)` block is now 
misleading: `update_scanner_profile()` is called unconditionally at the top of 
this Defer, so counters *are* updated even when `status` is not ok / `eos` is 
true. Please update the comment to describe the actual reason for gating only 
`start_wait_worker_timer()` here (or move `update_scanner_profile()` under the 
same condition if the intent is still to avoid counter updates on failures).
   ```suggestion
               // Restart the wait-worker timer only when this scanner will 
continue running
               // and be scheduled again. On failure or EOS there is no 
subsequent wait-for-worker
               // interval to record.
   ```



##########
be/src/vec/exec/scan/scanner_scheduler.cpp:
##########
@@ -177,6 +177,7 @@ void 
ScannerScheduler::_scanner_scan(std::shared_ptr<ScannerContext> ctx,
     Status status = Status::OK();
     bool eos = false;
     Defer defer_scanner([&] {
+        update_scanner_profile();
         if (status.ok() && !eos) {
             // if status is not ok, it means the scanner is failed, and the 
counter may be not updated correctly, so no need to update counter again. if 
eos is true, it means the scanner is finished successfully, and the counter is 
updated correctly, so no need to update counter again.

Review Comment:
   This change fixes an important accounting issue on non-eos yield paths; it 
would be valuable to add a unit/integration test that exercises a yield exit 
(e.g. max-run-time break) and asserts that scan CPU timer and realtime counters 
are updated for that round. There are existing scan-related gtests under 
`be/test/scan/`, but none appear to cover this behavior.
   ```suggestion
           if (!eos) {
               // The current round's profile has already been finalized above.
               // If the scanner is not at eos, it may be scheduled again, so 
restart
               // the wait-worker timer for the next round regardless of how 
this
               // non-eos round exited.
   ```



-- 
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]

Reply via email to