use of org.apache.geode.internal.cache.partitioned.DumpB2NRegion.DumpB2NResponse in project geode by apache.
the class PartitionedRegion method getBucketOwnersForValidation.
/**
* Test Method: Fetch the given bucket's meta-data from each member hosting buckets
*
* @param bucketId the identity of the bucket
* @return list of arrays, each array element containing a {@link DistributedMember} and a
* {@link Boolean} the boolean denotes if the member is hosting the bucket and believes it
* is the primary
* @throws ForceReattemptException if the caller should reattempt this request
*/
public List getBucketOwnersForValidation(int bucketId) throws ForceReattemptException {
// bucketid 1 => "vm A", false | "vm B", false | "vm C", true | "vm D", false
// bucketid 2 => List< Tuple(MemberId mem, Boolean isPrimary) >
// remotely fetch each VM's bucket meta-data (versus looking at the bucket
// advisor's data
RuntimeException rte = null;
List remoteInfos = null;
for (int i = 0; i < 3; i++) {
rte = null;
DumpB2NResponse response = DumpB2NRegion.send(getRegionAdvisor().adviseDataStore(), this, bucketId, true);
try {
remoteInfos = new LinkedList(response.waitForPrimaryInfos());
} catch (TimeoutException e) {
rte = e;
logger.info("DumpB2NRegion failed to get PR {}, bucket id {}'s info due to {}, retrying...", this.getFullPath(), bucketId, e.getMessage());
}
}
if (rte != null) {
logger.info("DumpB2NRegion retried 3 times", rte);
throw rte;
}
// Include current VM in the status...
if (getRegionAdvisor().getBucket(bucketId).isHosting()) {
if (getRegionAdvisor().isPrimaryForBucket(bucketId)) {
remoteInfos.add(new Object[] { getSystem().getDM().getId(), Boolean.TRUE, "" });
} else {
remoteInfos.add(new Object[] { getSystem().getDM().getId(), Boolean.FALSE, "" });
}
}
return remoteInfos;
}
Aggregations