Copilot commented on code in PR #57436:
URL: https://github.com/apache/doris/pull/57436#discussion_r2471942388
##########
be/src/vec/exec/scan/jdbc_scanner.cpp:
##########
@@ -188,6 +188,10 @@ void JdbcScanner::_update_profile() {
}
Status JdbcScanner::close(RuntimeState* state) {
+ bool expected = false;
+ if (!_is_closed.compare_exchange_strong(expected, true)) {
+ return Status::OK();
+ }
Review Comment:
The parent class `Scanner::close(state)` is called at line 195 after this
method has already set `_is_closed` to true via compare-exchange at line 192.
Since both methods operate on the same atomic variable, the parent's
compare-exchange will always fail (expected=false won't match _is_closed=true
already set by child), making the parent close effectively a no-op. The
parent's close should be called unconditionally without checking `_is_closed`
again, or the child should not perform its own compare-exchange.
```suggestion
```
##########
be/src/vec/exec/scan/olap_scanner.cpp:
##########
@@ -594,7 +594,8 @@ Status OlapScanner::_get_block_impl(RuntimeState* state,
Block* block, bool* eof
}
Status OlapScanner::close(RuntimeState* state) {
- if (_is_closed) {
+ bool expected = false;
+ if (!_is_closed.compare_exchange_strong(expected, true)) {
return Status::OK();
}
Review Comment:
The parent class `Scanner::close(state)` is called at line 601 after this
method has already set `_is_closed` to true via compare-exchange at line 598.
Since both methods operate on the same atomic variable, the parent's
compare-exchange will always fail (expected=false won't match _is_closed=true
already set by child), making the parent close effectively a no-op. The
parent's close should be called unconditionally without checking `_is_closed`
again, or the child should not perform its own compare-exchange.
```suggestion
```
--
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]