Jackie-Jiang commented on code in PR #8584: URL: https://github.com/apache/pinot/pull/8584#discussion_r862273056
########## pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/assignment/segment/RealtimeSegmentAssignment.java: ########## @@ -368,12 +364,19 @@ private List<String> assignCompletedSegment(String segmentName, Map<String, Map< // Replica-group based assignment // Uniformly spray the segment partitions over the instance partitions - int segmentPartitionId = - SegmentUtils.getRealtimeSegmentPartitionId(segmentName, _realtimeTableName, _helixManager, _partitionColumn); - int numPartitions = instancePartitions.getNumPartitions(); - int partitionGroupId = segmentPartitionId % numPartitions; - return SegmentAssignmentUtils - .assignSegmentWithReplicaGroup(currentAssignment, instancePartitions, partitionGroupId); + int partitionId = getPartitionGroupId(segmentName) % instancePartitions.getNumPartitions(); + return SegmentAssignmentUtils.assignSegmentWithReplicaGroup(currentAssignment, instancePartitions, partitionId); + } + } + + private int getPartitionGroupId(String segmentName) { + Integer segmentPartitionId = + SegmentUtils.getRealtimeSegmentPartitionId(segmentName, _realtimeTableName, _helixManager, _partitionColumn); + if (segmentPartitionId == null) { + // This case is for the uploaded segments for which there's no partition information + // Choose a random, but consistent, partition id + segmentPartitionId = Math.abs(segmentName.hashCode()); Review Comment: +1. We may bound the partition group id to some large number (e.g. `Math.abs(segmentName.hashCode() % 10000)` -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org