hqx871 commented on code in PR #64167:
URL: https://github.com/apache/doris/pull/64167#discussion_r3373032721
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java:
##########
@@ -3369,23 +3514,43 @@ public TStorageMedium createTablets(MaterializedIndex
index, ReplicaState replic
throws DdlException {
ColocateTableIndex colocateIndex = Env.getCurrentColocateIndex();
SystemInfoService systemInfoService = Env.getCurrentSystemInfo();
- Map<Tag, List<List<Long>>> backendsPerBucketSeq = null;
- GroupId groupId = null;
+ TenantLevelColocateTableIndex tenantLevelColocateIndex =
Env.getCurrentTenantLevelColocateIndex();
+ Map<Tag, List<List<Long>>> backendsPerBucketSeq = new HashMap<>();
+ boolean isColocateV1 = false;
+ boolean isColocateV2Master = false;
+ Set<Tag> colocateTags = new HashSet<>();
if (colocateIndex.isColocateTable(tabletMeta.getTableId())) {
if (distributionInfo.getType() == DistributionInfoType.RANDOM) {
throw new DdlException("Random distribution for colocate table
is unsupported");
}
// if this is a colocate table, try to get backend seqs from
colocation index.
- groupId = colocateIndex.getGroup(tabletMeta.getTableId());
- backendsPerBucketSeq =
colocateIndex.getBackendsPerBucketSeq(groupId);
+ GroupId groupId = colocateIndex.getGroup(tabletMeta.getTableId());
+
backendsPerBucketSeq.putAll(colocateIndex.getBackendsPerBucketSeq(groupId));
+ isColocateV1 = true;
+ colocateTags.addAll(replicaAlloc.getAllocMap().keySet());
+ } else if ((isColocateV2Master =
tenantLevelColocateIndex.isColocateMasterTable(tabletMeta.getTableId()))
+ ||
tenantLevelColocateIndex.isColocateSlaveTable(tabletMeta.getTableId())) {
+ if (distributionInfo.getType() == DistributionInfoType.RANDOM) {
+ throw new DdlException("Random distribution for colocate table
is unsupported");
+ }
+ // if this is a colocate table, try to get backend seqs from
colocation index.
+
backendsPerBucketSeq.putAll(tenantLevelColocateIndex.getBackendsPerBucketSeqByTable(tabletMeta.getTableId(),
+ distributionInfo.getBucketNum()));
+
colocateTags.addAll(tenantLevelColocateIndex.getAllSlaveTagByTable(tabletMeta.getTableId()));
+ colocateTags.forEach(tag ->
Preconditions.checkState(backendsPerBucketSeq.containsKey(tag)));
Review Comment:
For slave tag, the be location of bucket must be exist
--
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]