upthewaterspout commented on a change in pull request #7124:
URL: https://github.com/apache/geode/pull/7124#discussion_r779144202



##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/rebalance/model/PartitionedRegionLoadModel.java
##########
@@ -425,19 +425,58 @@ public void remoteOverRedundancyBucket(BucketRollup 
bucket, Member targetMember)
   }
 
   private void initLowRedundancyBuckets() {
-    this.lowRedundancyBuckets = new TreeSet<>(REDUNDANCY_COMPARATOR);
     for (BucketRollup b : this.buckets) {
       if (b != null && b.getRedundancy() >= 0 && b.getRedundancy() < 
this.requiredRedundancy) {
         this.lowRedundancyBuckets.add(b);
       }
     }
   }
 
+
+  /**
+   * Original functionality if bucket's redundancy is greater than what is 
necessary add it to the
+   * over redundancy bucket list, so it can be cleared
+   * <p>
+   * Newly added functionality is to make this so that we don't have a bucket 
in the same redundancy
+   * zone twice if zones are in use.
+   */
   private void initOverRedundancyBuckets() {
     this.overRedundancyBuckets = new TreeSet<>(REDUNDANCY_COMPARATOR);
+    Set<String> redundancyZonesFound = new HashSet<>();
+
+    // For every bucket
     for (BucketRollup b : this.buckets) {
-      if (b != null && b.getOnlineRedundancy() > this.requiredRedundancy) {
-        this.overRedundancyBuckets.add(b);
+      if (b != null) {
+        // check to see if the existing redundancy is greater than required
+        if (b.getOnlineRedundancy() > this.requiredRedundancy) {
+          // if so, add the bucket to the over redundancy list
+          this.overRedundancyBuckets.add(b);
+        } else {

Review comment:
       I think it would be good move the logic in the else block to a separate 
method for testability/readability. This whole stanza is really just asking 
"are two copies in the same zone".




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