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


##########
fe/fe-core/src/main/java/org/apache/doris/qe/AuditLogHelper.java:
##########
@@ -413,6 +413,30 @@ private static long getQueueTimeMs(ConnectContext ctx) {
         return queueToken == null ? -1 : queueToken.getQueueEndTime() - 
queueToken.getQueueStartTime();
     }
 
+    static String getCloudClusterForAudit(ConnectContext ctx) throws 
ComputeGroupException {
+        ConnectContext.EffectiveCloudCluster effectiveCloudCluster = 
ctx.getEffectiveCloudCluster();
+        if (effectiveCloudCluster != null) {
+            return effectiveCloudCluster.getCluster();
+        }
+        return ctx.getCloudCluster(false);
+    }
+
+    static String getPhysicalCloudClusterForAudit(ConnectContext ctx) throws 
ComputeGroupException {
+        ConnectContext.EffectiveCloudCluster effectiveCloudCluster = 
ctx.getEffectiveCloudCluster();
+        if (effectiveCloudCluster != null) {
+            return effectiveCloudCluster.getPhysicalCluster();
+        }
+        String cloudCluster = ctx.getCloudCluster(false);
+        return ((CloudSystemInfoService) 
Env.getCurrentSystemInfo()).getPhysicalCluster(cloudCluster);
+    }
+
+    static void captureCloudClusterForAudit(ConnectContext ctx) throws 
ComputeGroupException {

Review Comment:
   [P2] Capture the physical group on Nereids execution paths
   
   This fallback is still used by the default distributed-planner path: 
executeAndSendResult constructs NereidsCoordinator directly, while 
BackendDistributedPlanWorkerManager resolves a virtual group V to physical 
group A and snapshots A's backend list without setting effectiveCloudCluster. 
If V switches to B after worker selection, this post-execution lookup records 
V/B and the physical query, error, and latency metrics are charged to B even 
though A ran the query. PointQueryExecutor also selects concrete backends 
without going through CloudCoordinator, and a prepared queryRetry can retain an 
earlier attempt's snapshot because the outer execution keeps depth nonzero. 
This is distinct from the legacy CloudCoordinator instance fixed in this head; 
record and replace the logical/physical snapshot whenever these paths select 
workers instead of reconstructing it here.



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