mridulm commented on code in PR #2126:
URL: 
https://github.com/apache/incubator-celeborn/pull/2126#discussion_r1411769815


##########
master/src/main/java/org/apache/celeborn/service/deploy/master/SlotsAllocator.java:
##########
@@ -338,17 +398,18 @@ private static List<Integer> roundRobin(
                   workerDiskIndexForReplica,
                   availableStorageTypes);
         } else if (shouldRackAware) {
-          while (!satisfyRackAware(true, workers, nextPrimaryInd, 
nextReplicaInd)) {
-            nextReplicaInd = (nextReplicaInd + 1) % workers.size();
-            if (nextReplicaInd == nextPrimaryInd) {
+          while (nextReplicaInd == nextPrimaryInd
+              || !satisfyRackAware(true, workers, nextPrimaryInd, 
nextReplicaInd)) {
+            nextReplicaInd = incrementIndex.applyAsInt(nextReplicaInd);
+            if (nextReplicaInd == replicaIndex) {
               break outer;
             }
           }
         } else {
           if (StorageInfo.localDiskAvailable(availableStorageTypes)) {
-            while (!workers.get(nextPrimaryInd).haveDisk()) {
-              nextPrimaryInd = (nextPrimaryInd + 1) % workers.size();
-              if (nextPrimaryInd == primaryIndex) {
+            while (nextReplicaInd == nextPrimaryInd || 
!workers.get(nextReplicaInd).haveDisk()) {
+              nextReplicaInd = incrementIndex.applyAsInt(nextReplicaInd);
+              if (nextReplicaInd == replicaIndex) {

Review Comment:
   0.3 did not have this change - but this is an unrelated bug fix (should be 
checking/updating `nextReplicaInd`, not `nextPrimaryInd` imo ... please do 
validate this reviewers !)



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

Reply via email to