github-actions[bot] commented on code in PR #65173:
URL: https://github.com/apache/doris/pull/65173#discussion_r3520355692


##########
fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java:
##########
@@ -382,6 +386,18 @@ public String getExplainString(String prefix, 
TExplainLevel explainLevel) {
         return strBuilder.toString();
     }
 
+    // Only printed when the session enables load local affinity, so existing 
plans stay unchanged.
+    private void appendSinkAffinityExplain(StringBuilder strBuilder, String 
prefix) {
+        ResourceGroupAffinity.AffinityDecision decision =
+                
ResourceGroupAffinityPolicyFactory.get().decideForLoad(ConnectContext.get());

Review Comment:
   This EXPLAIN helper bypasses the same load-affinity gate used by the real 
sink scheduling path. The comment says this is only printed when the session 
enables load local affinity, but `appendSinkAffinityExplain()` calls 
`decideForLoad(ConnectContext.get())` unconditionally; 
`chooseSingleReplicaMaster()` below returns to random selection before invoking 
the SPI when `isLoadAffinityEnabled(context)` is false. A downstream 
implementation can keep `decideForLoad()` non-null or validate context even 
when the session flag is off, so `EXPLAIN INSERT` can change plan text or fail 
despite scheduling affinity being disabled. Please check 
`isLoadAffinityEnabled()` before calling `decideForLoad()` here, and cover the 
disabled EXPLAIN path with a policy that would otherwise return a decision.



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