/** * Returns the lockname used by Distributed Lock service to clean the * <code> allPartitionedRegions<code> * * @return String */ private String getLockNameForBucket2NodeModification(int bucketID) { return (getRegionIdentifier() + ":" + bucketID); }
/** * Returns the lockname used by Distributed Lock service to clean the * <code> allPartitionedRegions<code> * * @return String */ private String getLockNameForBucket2NodeModification(int bucketID) { return (getRegionIdentifier() + ":" + bucketID); }
protected RecoveryLock() { super(PartitionedRegion.this.getRegionIdentifier() + "-RecoveryLock", getCache(), false); }
protected RecoveryLock() { super(PartitionedRegion.this.getRegionIdentifier() + "-RecoveryLock", getCache(), false); }
/** * This method prints the content of the allPartitionedRegion's contents for * this PartitionedRegion. */ public void dumpSelfEntryFromAllPartitionedRegions() { StringBuffer b = new StringBuffer(this.prRoot.getFullPath()); b.append("Dumping allPartitionedRegions for "); b.append(this); b.append("\n"); b.append(this.prRoot.get(getRegionIdentifier())); logger.debug(b.toString()); }
/** * This method prints the content of the allPartitionedRegion's contents for * this PartitionedRegion. */ public void dumpSelfEntryFromAllPartitionedRegions() { StringBuffer b = new StringBuffer(this.prRoot.getFullPath()); b.append("Dumping allPartitionedRegions for "); b.append(this); b.append("\n"); b.append(this.prRoot.get(getRegionIdentifier())); logger.info(LocalizedStrings.ONE_ARG, b.toString()); }
public RegionLock getRegionLock() { return getRegionLock(getRegionIdentifier(), getGemFireCache()); }
public RegionLock getRegionLock() { return getRegionLock(getRegionIdentifier(), getGemFireCache()); }
public void memberDeparted(final InternalDistributedMember id, final boolean crashed) { try { DistributedMember dmem = prRegion.getSystem().getDistributedMember(); if(logger.isDebugEnabled()) { logger.debug("MembershipListener invoked on DistributedMember = {} for failed memberId = {}", dmem, id); } if (! prRegion.isCacheClosing() && !prRegion.isDestroyed() && ! dmem.equals(id)) { Runnable postRecoveryTask = null; //Only schedule redundancy recovery if this not a fixed PR. if (!PRHARedundancyProvider.this.prRegion.isFixedPartitionedRegion()) { postRecoveryTask = new Runnable() { public void run() { //After the metadata has been cleaned, recover redundancy. scheduleRedundancyRecovery(id); } }; } //Schedule clean up the metadata for the failed member. PartitionedRegionHelper.cleanUpMetaDataForRegion(prRegion.getCache(), prRegion.getRegionIdentifier(), id, postRecoveryTask); } } catch(CancelException e) { //ignore } }
@Override public void run2() throws CacheException { Cache cache = getCache(); Region root = PartitionedRegionHelper.getPRRoot(cache); // Region allPartitionedRegions = PartitionedRegionHelper // .getPRConfigRegion(root, cache); for (int i = 0; i < MAX_REGIONS; i++) { Region region = cache.getRegion("/" + rgionName + String.valueOf(i)); String name = ((PartitionedRegion)region).getRegionIdentifier(); PartitionRegionConfig prConfig = (PartitionRegionConfig)root .get(name); if (prConfig == null) fail("PartionedRegionRegistrationTest() - PartionedRegion - " + name + " configs do not exists in region - " + root.getName()); } getLogWriter().info(" PartitionedRegionCreationTest PartionedRegionRegistrationTest() Successfully Complete .. "); } };
while (itr.hasNext()) { Region region = (Region)itr.next(); String name = ((PartitionedRegion)region).getRegionIdentifier(); PartitionRegionConfig prConfig = (PartitionRegionConfig)root .get(name);
.get(partitionedRegion.getRegionIdentifier()); if( prConfig == null ) return;
/** A utility to check to see if a region has been created on * all of the VMs that host the regions this region is colocated with. */ public static boolean isColocationComplete(PartitionedRegion region) { Region prRoot = PartitionedRegionHelper.getPRRoot(region .getCache()); PartitionRegionConfig config = (PartitionRegionConfig) prRoot.get(region.getRegionIdentifier()); //Fix for bug 40075. There is race between this call and the region being concurrently //destroyed. if(config == null) { Assert.assertTrue(region.isDestroyed() || region.isClosed, "Region is not destroyed, but there is no entry in the prRoot for region " + region); return false; } return config.isColocationComplete(); }
/** A utility to check to see if a region has been created on * all of the VMs that host the regions this region is colocated with. */ public static boolean isColocationComplete(PartitionedRegion region) { Region prRoot = PartitionedRegionHelper.getPRRoot(region .getCache()); PartitionRegionConfig config = (PartitionRegionConfig) prRoot.get(region.getRegionIdentifier()); //Fix for bug 40075. There is race between this call and the region being concurrently //destroyed. if(config == null) { Assert.assertTrue(region.isDestroyed(), "Region is not destroyed, but there is no entry in the prRoot for region " + region); return false; } return config.isColocationComplete(); }
private void populateAllPartitionedRegion(PartitionedRegion pr, List nodes) { // int totalNodes = 4; Region rootReg = PartitionedRegionHelper.getPRRoot(pr.getCache()); // Region allPRs = PartitionedRegionHelper.getPRConfigRegion(rootReg, pr // .getCache()); PartitionRegionConfig prConf = new PartitionRegionConfig(pr.getPRId(), pr .getFullPath(), pr.getPartitionAttributes(), pr.getScope()); RegionAdvisor ra = pr.getRegionAdvisor(); for (Iterator itr = nodes.iterator(); itr.hasNext();) { Node n = (Node)itr.next(); prConf.addNode(n); PartitionProfile pp = (PartitionProfile) ra.createProfile(); pp.peerMemberId = n.getMemberId(); pp.isDataStore = true; final boolean forceFakeProfile = true; pr.getRegionAdvisor().putProfile(pp, forceFakeProfile); } rootReg.put(pr.getRegionIdentifier(), prConf); } }
/** * Utility method to print warning when nodeList in b2n region is found empty. * This will signify potential data loss scenario. * @param partitionedRegion * @param bucketId Id of Bucket whose nodeList in b2n is empty. * @param callingMethod methodName of the calling method. */ public static void logForDataLoss(PartitionedRegion partitionedRegion, int bucketId, String callingMethod) { if (! Boolean.getBoolean("gemfire.PRDebug")) { return; } Region root = PartitionedRegionHelper.getPRRoot(partitionedRegion.getCache()); // Region allPartitionedRegions = PartitionedRegionHelper.getPRConfigRegion( // root, partitionedRegion.getCache()); PartitionRegionConfig prConfig = (PartitionRegionConfig)root .get(partitionedRegion.getRegionIdentifier()); if( prConfig == null ) return; Set members = partitionedRegion.getDistributionManager() .getDistributionManagerIds(); LogWriterI18n logger = partitionedRegion.getLogWriterI18n(); logger.warning(LocalizedStrings.PartitionedRegionHelper_DATALOSS___0____SIZE_OF_NODELIST_AFTER_VERIFYBUCKETNODES_FOR_BUKID___1__IS_0, new Object[] {callingMethod, Integer.valueOf(bucketId)}); logger.warning(LocalizedStrings.PartitionedRegionHelper_DATALOSS___0____NODELIST_FROM_PRCONFIG___1, new Object[] {callingMethod, printCollection(prConfig.getNodes())}); logger.warning(LocalizedStrings.PartitionedRegionHelper_DATALOSS___0____CURRENT_MEMBERSHIP_LIST___1, new Object[] {callingMethod, printCollection(members)}); }
public void memberDeparted(final InternalDistributedMember id, final boolean crashed) { try { DistributedMember dmem = prRegion.getSystem().getDistributedMember(); if(getLogger().fineEnabled()) { getLogger().fine( "MembershipListener invoked on DistributedMember = " + dmem + " for failed memberId = " + id); } if (! prRegion.isCacheClosing() && !prRegion.isDestroyed() && ! dmem.equals(id)) { Runnable postRecoveryTask = null; //Only schedule redundancy recovery if this not a fixed PR. if (!PRHARedundancyProvider.this.prRegion.isFixedPartitionedRegion()) { postRecoveryTask = new Runnable() { public void run() { //After the metadata has been cleaned, recover redundancy. scheduleRedundancyRecovery(id); } }; } //Schedule clean up the metadata for the failed member. PartitionedRegionHelper.cleanUpMetaDataForRegion(prRegion.getCache(), prRegion.getRegionIdentifier(), id, postRecoveryTask); } } catch(CancelException e) { //ignore } }
private PartitionRegionConfig getPRConfigWithLatestExpirationAttributes(){ PartitionRegionConfig prConfig = this.prRoot.get(getRegionIdentifier()); PartitionRegionConfig newConfig = new PartitionRegionConfig( prConfig.getPRId(), prConfig.getFullPath(), prConfig.getPartitionAttrs(), prConfig.getScope(), prConfig.getEvictionAttributes(), this.getRegionIdleTimeout(), this.getRegionTimeToLive(), this.getEntryIdleTimeout(), this.getEntryTimeToLive(), prConfig.getGatewaySenderIds()); return newConfig; }
public void run2() { Cache cache = getCache(); for (int j = 0; j < MAX_REGIONS; j++) { PartitionedRegion pr = (PartitionedRegion)cache .getRegion(Region.SEPARATOR + PR_PREFIX + j); assertNotNull(pr); Node targetNode = (Node)MapBB.getBB().getSharedMap() .get(pr.getName()); checkBucketMetadataCleanup(pr, targetNode.getMemberId()); Region root = PartitionedRegionHelper.getPRRoot(cache); // Region allPartitionedRegions = PartitionedRegionHelper // .getPRConfigRegion(root, cache); PartitionRegionConfig prConfig = (PartitionRegionConfig)root .get(pr.getRegionIdentifier()); getLogWriter().info("prConfig = " + prConfig); if (prConfig.containsNode(targetNode)) { fail("Close clean up did not remove node from allPartitionedRegions"); } getLogWriter().info( "datastore2 validated closing of PR = " + PR_PREFIX + j + " on datastore 1"); } }
public void run2() { Cache cache = getCache(); for (int j = 0; j < MAX_REGIONS; j++) { PartitionedRegion pr = (PartitionedRegion)cache .getRegion(Region.SEPARATOR + PR_PREFIX + j); assertNotNull(pr); Node targetNode = (Node)MapBB.getBB().getSharedMap() .get(pr.getName()); checkBucketMetadataCleanup(pr, targetNode.getMemberId()); Region root = PartitionedRegionHelper.getPRRoot(cache); // Region allPartitionedRegions = PartitionedRegionHelper // .getPRConfigRegion(root, cache); PartitionRegionConfig prConfig = (PartitionRegionConfig)root .get(pr.getRegionIdentifier()); getLogWriter().info("prConfig = " + prConfig); if (prConfig.containsNode(targetNode)) { fail("Close clean up did not remove node from allPartitionedRegions"); } getLogWriter().info( "datastore2 validated closing of PR = " + PR_PREFIX + j + " on datastore 1"); } } });