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


##########
fe/fe-core/src/main/java/org/apache/doris/common/proc/ColocationGroupProcDir.java:
##########
@@ -74,4 +93,57 @@ public ProcResult fetchResult() throws AnalysisException {
         result.setRows(infos);
         return result;
     }
+
+    private Map<Tag, List<List<Long>>> getCloudBackendSeqsFromTablets(GroupId 
groupId, ColocateTableIndex index) {
+        Map<Tag, List<List<Long>>> backendsSeq = Maps.newHashMap();
+        List<Long> tableIds = index.getAllTableIds(groupId);
+        if (tableIds.isEmpty()) {
+            return backendsSeq;
+        }
+
+        long targetTableId = tableIds.get(0);
+        long targetDbId = groupId.dbId == 0 ? 
groupId.getDbIdByTblId(targetTableId) : groupId.dbId;
+        Database db = 
Env.getCurrentInternalCatalog().getDbNullable(targetDbId);

Review Comment:
   For global colocate groups this `groupId` is reconstructed from the proc 
path (`new GroupId(0, grpId)`) and does not carry the persisted `tblId2DbId` 
map. `getAllTableIds(groupId)` still succeeds because `GroupId.equals/hashCode` 
only use `dbId` and `grpId`, but `groupId.getDbIdByTblId(targetTableId)` then 
returns `null` and unboxes it, so `SHOW PROC /colocation_group/<0.grp>` fails 
with an NPE whenever the cloud fallback is used for a global group. Please 
resolve the db id from the stored group id, for example via 
`index.getGroup(targetTableId)`, or otherwise look up the table-to-db mapping 
before dereferencing it.



##########
fe/fe-core/src/main/java/org/apache/doris/common/proc/ColocationGroupProcDir.java:
##########
@@ -74,4 +93,57 @@ public ProcResult fetchResult() throws AnalysisException {
         result.setRows(infos);
         return result;
     }
+
+    private Map<Tag, List<List<Long>>> getCloudBackendSeqsFromTablets(GroupId 
groupId, ColocateTableIndex index) {
+        Map<Tag, List<List<Long>>> backendsSeq = Maps.newHashMap();
+        List<Long> tableIds = index.getAllTableIds(groupId);
+        if (tableIds.isEmpty()) {
+            return backendsSeq;
+        }
+
+        long targetTableId = tableIds.get(0);
+        long targetDbId = groupId.dbId == 0 ? 
groupId.getDbIdByTblId(targetTableId) : groupId.dbId;

Review Comment:
   The fallback gives up based only on `tableIds.get(0)`. If the first table in 
the colocate group is not a usable source, for example it currently has no 
partitions while another table in the same group has valid tablets, this 
returns an empty backend sequence and the proc shows no bucket rows even though 
the group can still be displayed from a later table. Since this path is 
specifically reconstructing missing legacy metadata, please iterate the group 
tables until an existing `OlapTable` with a partition/base tablets is found 
instead of returning empty on the first table's failure path.



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