You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "HonestManXin (via GitHub)" <gi...@apache.org> on 2026/04/22 13:42:07 UTC

[PR] [fix](point-query) avoid missing result packet for point query during master switch [doris]

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

   When master switch happen, the follower will briefly enter the unknown state. 
   At this time, isForwardedToMaster for every request will be determined as true, and during the finalizeCommand response packet phase, the master proxy result will be directly used as the result, leading to the loss of the real ResultPacket. Ultimately, the client remains hung while waiting for the result to return until the socket timeout.
   In fact, point query will never forward to master at present.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](query) avoid missing result packet for query during master switch [doris]

Posted by "HonestManXin (via GitHub)" <gi...@apache.org>.
HonestManXin commented on PR #62721:
URL: https://github.com/apache/doris/pull/62721#issuecomment-4301283886

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](point-query) avoid missing result packet for point query during master switch [doris]

Posted by "HonestManXin (via GitHub)" <gi...@apache.org>.
HonestManXin commented on PR #62721:
URL: https://github.com/apache/doris/pull/62721#issuecomment-4296682248

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](query) avoid missing result packet for query during master switch [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #62721:
URL: https://github.com/apache/doris/pull/62721#issuecomment-4301849357

   # FE Regression Coverage Report
   Increment line coverage `  0.00% (0/4)` :tada:
   [Increment coverage report](http://coverage.selectdb-in.cc/coverage/62721_f1d792038fdecb13819c29c20925262f08c46287_merge_fe/increment_report/index.html)
   [Complete coverage report](http://coverage.selectdb-in.cc/coverage/62721_f1d792038fdecb13819c29c20925262f08c46287_merge_fe/report/index.html)
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](point-query) avoid missing result packet for point query during master switch [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #62721:
URL: https://github.com/apache/doris/pull/62721#issuecomment-4298105478

   # FE UT Coverage Report
   Increment line coverage `  0.00% (0/2)` :tada:
   [Increment coverage report](http://coverage.selectdb-in.cc/coverage/62721_0d0f2b8bbbae76bf05b0f31b0c60e916007f8b91/fe_increment_report/index.html)
   [Complete coverage report](http://coverage.selectdb-in.cc/coverage/62721_0d0f2b8bbbae76bf05b0f31b0c60e916007f8b91/fe_report/index.html)
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](point-query) avoid missing result packet for point query during master switch [doris]

Posted by "HonestManXin (via GitHub)" <gi...@apache.org>.
HonestManXin commented on PR #62721:
URL: https://github.com/apache/doris/pull/62721#issuecomment-4297504828

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](query) avoid missing result packet for query during master switch [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #62721:
URL: https://github.com/apache/doris/pull/62721#issuecomment-4301584474

   # FE UT Coverage Report
   Increment line coverage `  0.00% (0/4)` :tada:
   [Increment coverage report](http://coverage.selectdb-in.cc/coverage/62721_f1d792038fdecb13819c29c20925262f08c46287/fe_increment_report/index.html)
   [Complete coverage report](http://coverage.selectdb-in.cc/coverage/62721_f1d792038fdecb13819c29c20925262f08c46287/fe_report/index.html)
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](query) avoid missing result packet for query during master switch [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #62721:
URL: https://github.com/apache/doris/pull/62721#issuecomment-4302340107

   PR approved by at least one committer and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](point-query) avoid missing result packet for point query during master switch [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #62721:
URL: https://github.com/apache/doris/pull/62721#discussion_r3125192357


##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -475,6 +475,16 @@ public ByteBuffer getOutputPacket() {
         }
     }
 
+    /**
+     * Whether this executor has actually forwarded to master and created a {@link MasterOpExecutor}.
+     *
+     * <p>Do not confuse with {@link #isForwardToMaster()} which is a decision (may be re-evaluated)
+     * based on current statement shape / redirect status.
+     */
+    public boolean hasForwardedToMaster() {

Review Comment:
   `finalizeCommand()` now keys off actual forwarding, but `ConnectProcessor.handleQuery()` and `AuditLogHelper` still consume `isForwardToMaster()` after execution. That is a distinct failure mode from the already-known packet-loss bug: on a follower that currently cannot read, a local wrapper such as `EXPLAIN SELECT ...; SELECT 1` rewrites `parsedStmt` to the inner query, so `isForwardToMaster()` becomes true even though `masterOpExecutor` is still null. `handleQuery()` then sees `getProxyStatusCode()==UNKNOWN` and breaks before executing the second statement, and audit logs also record a bogus proxy state. Please switch those post-execution call sites to `hasForwardedToMaster()` as well.



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](point-query) avoid missing result packet for point query during master switch [doris]

Posted by "HonestManXin (via GitHub)" <gi...@apache.org>.
HonestManXin commented on PR #62721:
URL: https://github.com/apache/doris/pull/62721#issuecomment-4296681160

   /review


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](query) avoid missing result packet for query during master switch [doris]

Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow merged PR #62721:
URL: https://github.com/apache/doris/pull/62721


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](point-query) avoid missing result packet for point query during master switch [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #62721:
URL: https://github.com/apache/doris/pull/62721#issuecomment-4298876647

   # FE Regression Coverage Report
   Increment line coverage `  0.00% (0/2)` :tada:
   [Increment coverage report](http://coverage.selectdb-in.cc/coverage/62721_0d0f2b8bbbae76bf05b0f31b0c60e916007f8b91_merge_fe/increment_report/index.html)
   [Complete coverage report](http://coverage.selectdb-in.cc/coverage/62721_0d0f2b8bbbae76bf05b0f31b0c60e916007f8b91_merge_fe/report/index.html)
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](point-query) avoid missing result packet for point query during master switch [doris]

Posted by "HonestManXin (via GitHub)" <gi...@apache.org>.
HonestManXin commented on PR #62721:
URL: https://github.com/apache/doris/pull/62721#issuecomment-4297503523

   /review


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](query) avoid missing result packet for query during master switch [doris]

Posted by "HonestManXin (via GitHub)" <gi...@apache.org>.
HonestManXin commented on PR #62721:
URL: https://github.com/apache/doris/pull/62721#issuecomment-4301283160

   /review


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](point-query) avoid missing result packet for point query during master switch [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #62721:
URL: https://github.com/apache/doris/pull/62721#discussion_r3124566499


##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -430,6 +430,10 @@ public void setPlanner(Planner planner) {
     }
 
     public boolean isForwardToMaster() {
+        // point-query currently never forward to the master
+        if (statementContext.isShortCircuitQuery()) {

Review Comment:
   `statementContext.isShortCircuitQuery()` is a sticky flag copied from `COM_STMT_PREPARE`. On the first `COM_STMT_EXECUTE`, or after `preparedStmtCtx.shortCircuitQueryContext` is invalidated by schema change, `ExecuteCommand.run()` falls back to `executor.execute()` and still needs the normal `!canRead()` forward-to-master safety check. Returning `false` here suppresses that replan-time forward decision and can execute a prepared point query against stale follower metadata during master switch, for example after the table is altered or dropped on the master. Please key this off the actual short-circuit execution path, not the prepare-time flag.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -430,6 +430,10 @@ public void setPlanner(Planner planner) {
     }
 
     public boolean isForwardToMaster() {
+        // point-query currently never forward to the master

Review Comment:
   This also does not fix the underlying `finalizeCommand()` bug for other local command wrappers that call `setParsedStmt()` with an inner query, such as `ExplainCommand.run()`. In that path `masterOpExecutor` is still `null`, but a later `isForwardToMaster()` re-evaluation can return `true` from the rewritten `parsedStmt`, and `finalizeCommand()` will skip the final EOF/OK packet again. The forwarding decision needs to reflect whether this executor actually forwarded, not whether the current `parsedStmt` happens to look like a query.



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](point-query) avoid missing result packet for point query during master switch [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #62721:
URL: https://github.com/apache/doris/pull/62721#issuecomment-4296674097

   
   Thank you for your contribution to Apache Doris.
   Don't know what should be done next? See [How to process your PR](https://cwiki.apache.org/confluence/display/DORIS/How+to+process+your+PR).
   
   Please clearly describe your PR:
   1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
   2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
   3. What features were added. Why was this function added?
   4. Which code was refactored and why was this part of the code refactored?
   5. Which functions were optimized and what is the difference before and after the optimization?
       


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org