You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by lg...@apache.org on 2017/08/23 19:00:11 UTC

geode git commit: GEODE-3507 PartitionedRegionRedundancyTracker now does not allow actualRedundantCopies stat to be negative

Repository: geode
Updated Branches:
  refs/heads/develop a229933ce -> 039edfce4


GEODE-3507 PartitionedRegionRedundancyTracker now does not allow actualRedundantCopies stat to be negative


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/039edfce
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/039edfce
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/039edfce

Branch: refs/heads/develop
Commit: 039edfce4bd5f58f967b98fad0ee72c4a0adfba4
Parents: a229933
Author: Lynn Gallinat <lg...@pivotal.io>
Authored: Wed Aug 23 11:49:54 2017 -0700
Committer: Lynn Gallinat <lg...@pivotal.io>
Committed: Wed Aug 23 11:52:37 2017 -0700

----------------------------------------------------------------------
 .../internal/cache/PartitionedRegionRedundancyTracker.java     | 2 +-
 .../internal/cache/PartitionedRegionRedundancyTrackerTest.java | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/039edfce/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java
index 38ef61b..1ff8bc9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTracker.java
@@ -134,6 +134,6 @@ class PartitionedRegionRedundancyTracker {
   }
 
   void setActualRedundancy(int actualRedundancy) {
-    stats.setActualRedundantCopies(actualRedundancy);
+    stats.setActualRedundantCopies(Math.max(actualRedundancy, 0));
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/039edfce/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java
index 0917835..0eba655 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionRedundancyTrackerTest.java
@@ -117,4 +117,10 @@ public class PartitionedRegionRedundancyTrackerTest {
     redundancyTracker.decrementNoCopiesBucketCount();
     assertEquals(1, redundancyTracker.getLowestBucketCopies());
   }
+
+  @Test
+  public void willNotSetActualRedundantCopiesStatBelowZero() {
+    redundancyTracker.setActualRedundancy(-1);
+    assertEquals(0, stats.getActualRedundantCopies());
+  }
 }