Copilot commented on code in PR #61064:
URL: https://github.com/apache/doris/pull/61064#discussion_r2888111323
##########
be/src/vec/exec/scan/scanner_scheduler.cpp:
##########
@@ -167,13 +174,18 @@ void
ScannerScheduler::_scanner_scan(std::shared_ptr<ScannerContext> ctx,
need_update_profile = false;
}
};
+ Status status = Status::OK();
+ bool eos = 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();
+ 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 on this line states "if eos is true, it means the scanner
is finished successfully," but this is inaccurate. The `eos` flag is also set
to `true` in error/cancellation paths (e.g., when `scanner->prepare()` or
`scanner->open()` fails, or when `ctx->done()` is true). It would be more
accurate to say "if eos is true, the scanner will not be re-queued (either
because it completed scanning, encountered an error, or the context was
cancelled), so no need to start the wait timer again."
```suggestion
// If status is not ok, the scanner has failed and its counters
may not be updated
// correctly, so there is no need to restart the wait-worker
timer. If eos is true,
// the scanner will not be re-queued (either because it
completed scanning,
// encountered an error, or the context was cancelled), so there
is no need to
// restart the wait-worker timer either.
```
--
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]