BiteTheDDDDt opened a new pull request, #62646:
URL: https://github.com/apache/doris/pull/62646

   ## Proposed changes
   
   `update_scanner_profile()` was only called when `eos==true`. On non-eos 
yield paths (e.g. scanner reaches `max_run_time_ms`, memory pressure, etc.), 
the CPU timer and realtime counters were never updated for that execution round.
   
   ### Bug 1: CPU timer permanently undercounted
   Since `start_scan_cpu_timer()` resets `_cpu_watch` at the start of each 
round, CPU time from all non-final rounds was permanently lost from 
`_scan_cpu_timer` and `resource_ctx cpu_cost_ms`.
   
   ### Bug 2: Realtime counters update delayed
   `update_realtime_counters()` was not called on yield, delaying workload 
group policy enforcement that depends on scan bytes/rows.
   
   ### Fix
   Call `update_scanner_profile()` in the `Defer` lambda so it runs on every 
exit path. The existing eos-path call is kept (needed before 
`mark_to_need_to_close()`), and the `need_update_profile` guard prevents double 
updates.
   
   This also aligns with the original design intent documented in comments 
(lines 157-161):
   ```
   // 3. update_scan_cpu_timer when defer
   // 4. start_wait_worker_timer when defer
   ```
   
   ## Further Plan
   Same fix will be applied to branch-4.0.


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