sajjad-moradi commented on code in PR #8584:
URL: https://github.com/apache/pinot/pull/8584#discussion_r862282454
##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/assignment/segment/RealtimeSegmentAssignment.java:
##########
@@ -158,7 +153,8 @@ private List<String> assignConsumingSegment(String
segmentName, InstancePartitio
int numInstances = instances.size();
List<String> instancesAssigned = new ArrayList<>(_replication);
for (int replicaId = 0; replicaId < _replication; replicaId++) {
- instancesAssigned.add(instances.get((partitionGroupId * _replication +
replicaId) % numInstances));
+ int instanceIndex = Math.abs(partitionGroupId * _replication +
replicaId) % numInstances;
Review Comment:
If partitionGroupId is a large number, `partitionGroupId * _replication +
replicaId` will roll over to negative numbers. That's why I put the Math.abs()
around it. Having said that, if we bound the partitionGroupId to a smaller
number - like % 1000 that Jackie is suggesting - we can remove the Math.abs()
here.
--
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]