Skip to content

Commit

Permalink
[fixes GEODE-414] Add a retry so that PRMetaData will be updated with
Browse files Browse the repository at this point in the history
correct data.
  • Loading branch information
pivotal-eshu committed Oct 23, 2015
1 parent 1e6cc66 commit a73dc1b
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,25 @@ public String description() {
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);
Expand Down

0 comments on commit a73dc1b

Please sign in to comment.