924060929 commented on code in PR #70348:
URL: https://github.com/apache/doris/pull/70348#discussion_r4612174868


##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -1529,6 +1529,10 @@ private void forwardToMaster() throws Exception {
         }
         masterOpExecutor.setMoreStmtExists(moreStmtExists);
         masterOpExecutor.execute();
+        // A successful RPC can still carry a failed statement. Do not apply 
its local changes.
+        if 
(MysqlStateType.ERR.name().equalsIgnoreCase(masterOpExecutor.getProxyStatus())) 
{

Review Comment:
   This guard fixes the SET/UNSET success callbacks, but internal callers that 
bypass `StmtExecutor.forwardToMaster()` also ignore SQL errors:
   
   - [Temporary-table 
cleanup](https://github.com/apache/doris/blob/9cf3154a9dc1071261a3fb603fcb102854ddf5cc/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java#L1201-L1224)
 only catches exceptions from `execute()`. A master SQL ERR returns normally 
even with `reportFailure=true`; [connection 
reset](https://github.com/apache/doris/blob/9cf3154a9dc1071261a3fb603fcb102854ddf5cc/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java#L368-L383)
 then clears the temporary-table registry despite unsuccessful cleanup.
   - [Transaction 
rollback](https://github.com/apache/doris/blob/9cf3154a9dc1071261a3fb603fcb102854ddf5cc/fe/fe-core/src/main/java/org/apache/doris/transaction/TransactionEntry.java#L331-L344)
 ignores the remote status and returns the transaction ID. [Its 
caller](https://github.com/apache/doris/blob/9cf3154a9dc1071261a3fb603fcb102854ddf5cc/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/TransactionRollbackCommand.java#L60-L75)
 then reports OK/ABORTED and clears the local transaction entry, even if the 
master rejected the rollback.
   - [Follower catalog 
refresh](https://github.com/apache/doris/blob/9cf3154a9dc1071261a3fb603fcb102854ddf5cc/fe/fe-core/src/main/java/org/apache/doris/datasource/MetastoreEventSyncDriver.java#L390-L401)
 ignores ERR. [Its 
caller](https://github.com/apache/doris/blob/9cf3154a9dc1071261a3fb603fcb102854ddf5cc/fe/fe-core/src/main/java/org/apache/doris/datasource/MetastoreEventSyncDriver.java#L191-L203)
 subsequently advances the event cursor although the required full refresh 
failed, bypassing the exception-based retry/reset path.
   
   Could we make this distinction explicit in the executor API, e.g. retain 
raw-result execution for protocol forwarding and provide an 
`executeOrThrow()`/shared failure check for internal operations? Negative tests 
should verify that remote ERR cannot clear cleanup bookkeeping, report rollback 
success, or advance the refresh cursor.
   
   These are existing issues, not regressions introduced by this guard, so 
follow-up fixes can remain separate from this SET/UNSET patch. This location 
covers post-forward callbacks, not all uses of `MasterOpExecutor.execute()`. 
This assessment is based on source tracing; these internal ERR paths were not 
runtime-tested.



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