You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2015/11/02 22:52:53 UTC

[27/50] [abbrv] incubator-geode git commit: [fixes GEODE-414] Add a retry so that PRMetaData will be updated with correct data.

[fixes GEODE-414] Add a retry so that PRMetaData will be updated with
correct data.


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

Branch: refs/heads/feature/GEODE-328
Commit: a73dc1b7dc1b17429e73c7e97b5dceff203eed82
Parents: 1e6cc66
Author: eshu <es...@pivotal.io>
Authored: Thu Oct 22 17:08:47 2015 -0700
Committer: eshu <es...@pivotal.io>
Committed: Thu Oct 22 17:08:47 2015 -0700

----------------------------------------------------------------------
 .../PartitionedRegionSingleHopDUnitTest.java     | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a73dc1b7/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java
index 278c477..0e2ec72 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java
@@ -830,6 +830,25 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
     assertTrue(regionMetaData.containsKey(region.getFullPath()));
     
     final ClientPartitionAdvisor prMetaData = regionMetaData.get(region.getFullPath()); 
+    
+    //Fixes a race condition in GEODE-414 by retrying as 
+    //region.clientMetaDataLock.tryLock() may prevent fetching the 
+    //metadata through functional calls as only limited functions are executed in the test.
+    long start = System.currentTimeMillis();
+    do {
+      if ((prMetaData.getBucketServerLocationsMap_TEST_ONLY().size() !=4)) {
+        //waiting if there is another thread holding the lock
+        try {
+          Thread.sleep(1000);
+        } catch (InterruptedException e) {
+          //ignored.
+        }
+        cms.getClientPRMetadata((LocalRegion)region);
+      } else {
+        break;
+      }
+    } while (System.currentTimeMillis() - start < 60000);
+    
     wc = new WaitCriterion() {
       public boolean done() {
         return (prMetaData.getBucketServerLocationsMap_TEST_ONLY().size() == 4);