geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasonhu...@apache.org
Subject [07/26] geode git commit: GEODE-2902: fix intermittent unit test failure
Date Sat, 13 May 2017 00:35:49 GMT
GEODE-2902: fix intermittent unit test failure


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

Branch: refs/heads/feature/GEODE-2900
Commit: 014ad426a7a700bec54a6cedd04522a93dfa134e
Parents: 820b87c
Author: Darrel Schneider <dschneider@pivotal.io>
Authored: Wed May 10 13:57:21 2017 -0700
Committer: Darrel Schneider <dschneider@pivotal.io>
Committed: Wed May 10 13:57:56 2017 -0700

----------------------------------------------------------------------
 .../OffHeapLRURecoveryRegressionTest.java       | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/014ad426/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapLRURecoveryRegressionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapLRURecoveryRegressionTest.java
b/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapLRURecoveryRegressionTest.java
index bb781e6..dc70fb4 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapLRURecoveryRegressionTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapLRURecoveryRegressionTest.java
@@ -17,6 +17,7 @@ package org.apache.geode.internal.offheap;
 import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
 import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
@@ -71,7 +72,24 @@ public class OffHeapLRURecoveryRegressionTest {
       try {
         createDiskStore(gfc);
         try {
-          assertEquals(10, MemoryAllocatorImpl.getAllocator().getStats().getObjects());
+          int offHeapObjects = MemoryAllocatorImpl.getAllocator().getStats().getObjects();
+          if (offHeapObjects < 10) {
+            fail("expected at least 10 offheap values to be recovered but only did "
+                + offHeapObjects);
+          }
+          if (offHeapObjects > 15) {
+            // Why "> 15" instead of "== 10"?
+            // As we recover values we asynchronously notify the resource manager
+            // of how much off-heap memory was consumed. Once it sees we are over
+            // the LRU limit then recovery of values will stop happening.
+            // Since it is async it can allow us to exceed the LRU limit.
+            // So far this test usually sees 10 but sometimes sees 11.
+            // I allow up to 15 just to prevent intermittent test failures.
+            // We should consider changing this async notification to be sync so
+            // that the limit can not be exceeded.
+            fail("expected at most 15 offheap values to be recovered but actually did "
+                + offHeapObjects);
+          }
         } finally {
           DiskStore ds = gfc.findDiskStore(DS_NAME);
           ds.destroy();


Mime
View raw message