Copilot commented on code in PR #18692:
URL: https://github.com/apache/iotdb/pull/18692#discussion_r4068993466
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java:
##########
@@ -645,16 +647,60 @@ private TSStatus extendRegionGroupIfNecessary(
return result;
}
+ private TSStatus proactiveExtendRegionGroupIfNecessary(
+ final Map<String, ? extends Collection<TSeriesPartitionSlot>>
unassignedPartitionSlotsMap,
+ final TConsensusGroupType consensusGroupType)
+ throws DatabaseNotExistsException, NotEnoughDataNodeException {
+ final Map<String, Integer> allotmentMap = new HashMap<>();
+ for (Map.Entry<String, ? extends Collection<TSeriesPartitionSlot>> entry :
+ unassignedPartitionSlotsMap.entrySet()) {
+ final String database = entry.getKey();
+ final int maxRegionGroupCount =
+ getClusterSchemaManager().getMaxRegionGroupNum(database,
consensusGroupType);
+ final int minRegionGroupCount =
+ getClusterSchemaManager().getMinRegionGroupNum(database,
consensusGroupType);
+ final int allocatedRegionGroupCount =
+ partitionInfo.getRegionGroupCount(database, consensusGroupType);
+ // As with AUTO, grow toward the minimum by at most the number of
pending series slots.
+ // An existing data slot with new time partitions also contributes to
this incremental growth.
+ final int minimumRegionGroupTarget =
+ Math.min(minRegionGroupCount, allocatedRegionGroupCount +
entry.getValue().size());
Review Comment:
The active-slot term is deduplicated by `getSeriesPartitionSlotsCount`, but
the minimum-growth term still uses `Collection.size()`.
`filterUnassignedSchemaPartitionSlots` preserves duplicate entries, and the
slots RPC accepts a `List`, so a new database with minimum 4 and a request such
as `[slot, slot]` can create two groups for one distinct pending slot. Count
distinct pending slots here as well to keep PROACTIVE's documented
one-group-per-distinct-slot behavior.
--
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]