Copilot commented on code in PR #63636:
URL: https://github.com/apache/doris/pull/63636#discussion_r3298955347


##########
fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java:
##########
@@ -780,6 +782,20 @@ private List<TOlapTableLocationParam> createLocation(long 
dbId, OlapTable table)
         TOlapTableLocationParam slaveLocationParam = new 
TOlapTableLocationParam();
         // BE id -> path hash
         Multimap<Long, Long> allBePathsMap = HashMultimap.create();
+        // In cloud mode, the cluster id resolved from ConnectContext is 
identical for every
+        // tablet in this createLocation call. Resolve it ONCE here and reuse 
it for all
+        // tablets below; otherwise CloudReplica.getCurrentClusterId() would 
run its full
+        // pipeline (ConnectContext lookup, priv check, status check, 
autoStart, existence
+        // check, plus the read-lock CAS pair inside each) per tablet -- on 
multi-thousand
+        // tablet queries this was the single dominant FE hotspot.
+        String cachedClusterId = null;
+        if (Config.isCloudMode()) {
+            try {
+                cachedClusterId = CloudReplica.getCurrentClusterId();
+            } catch (ComputeGroupException e) {
+                throw new UserException(InternalErrorCode.INTERNAL_ERR, 
e.getMessage());

Review Comment:
   In `createLocation`, the `ComputeGroupException` from 
`CloudReplica.getCurrentClusterId()` is wrapped into a new `UserException` 
using only `e.getMessage()`, which drops the original exception as the 
cause/stack trace. Since `ComputeGroupException` already extends 
`UserException`, consider either rethrowing it directly or using the 
`UserException(InternalErrorCode, msg, cause)` ctor to preserve the cause for 
troubleshooting.
   



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