public String toString() { final StringBuilder sb = new StringBuilder(); sb.append(getClass().getName()); sb.append("[path='").append(getFullPath()); sb.append("';scope=").append(this.proxy.getScope()); sb.append("';dataPolicy=").append(this.proxy.getDataPolicy()); sb.append(" ;bucketIds=").append(this.buckets); return sb.append(']').toString(); }
@Override public String toString() { return new StringBuffer().append("Partitioned Region ").append("@") .append(Integer.toHexString(hashCode())).append(" [").append("path='").append(getFullPath()) .append("'; dataPolicy=").append(this.getDataPolicy()).append("; prId=") .append(this.partitionedRegionId).append("; isDestroyed=").append(this.isDestroyed) .append("; isClosed=").append(this.isClosed).append("; retryTimeout=") .append(this.retryTimeout).append("; serialNumber=").append(getSerialNumber()) .append("; partition attributes=").append(getPartitionAttributes().toString()) .append("; on VM ").append(getMyId()).append("]").toString(); }
/** * Test to see if there are any persistent child regions of a partitioned region. */ public static boolean hasPersistentChildRegion(PartitionedRegion region) { for (PartitionedRegion child : getColocatedChildRegions(region)) { if (child.getDataPolicy().withPersistence()) { return true; } } return false; } }
/** * Throw an exception if persistent data recovery from disk is not complete for this region. */ public void checkPROffline() throws PartitionOfflineException { if (getDataPolicy().withPersistence() && !recoveredFromDisk) { Set<PersistentID> persistIds = new HashSet(getRegionAdvisor().advisePersistentMembers().values()); persistIds.removeAll(getRegionAdvisor().adviseInitializedPersistentMembers().values()); throw new PartitionOfflineException(persistIds, String.format("Partitioned Region %s is offline due to unrecovered persistent data, %s", new Object[] {getFullPath(), persistIds})); } }
private PartitionedRegion findPersistentRegionRecursively(PartitionedRegion pr) { if (pr.getDataPolicy().withPersistence()) { return pr; } for (PartitionedRegion child : ColocationHelper.getColocatedChildRegions(pr)) { PartitionedRegion leader = findPersistentRegionRecursively(child); if (leader != null) { return leader; } } return null; }
/** * Creates a new RedundancyLogger. * */ public RedundancyLogger(PRHARedundancyProvider prhaRedundancyProvider) { super(prhaRedundancyProvider); PartitionedRegion baseRegion = ColocationHelper.getLeaderRegion(redundancyProvider.prRegion); List<PartitionedRegion> colocatedRegions = ColocationHelper.getColocatedChildRegions(baseRegion); List<RegionStatus> allRegions = new ArrayList<RegionStatus>(colocatedRegions.size() + 1); if (baseRegion.getDataPolicy().withPersistence()) { allRegions.add(new RegionStatus(baseRegion)); } for (PartitionedRegion region : colocatedRegions) { if (region.getDataPolicy().withPersistence()) { allRegions.add(new RegionStatus(region)); } } this.regions = Collections.unmodifiableList(allRegions); this.allBucketsRecoveredFromDisk = redundancyProvider.getAllBucketsRecoveredFromDiskLatch(); this.membershipChanged = true; addListeners(); }
private boolean isRebalanceNecessary() { // Fixed partitions will always be rebalanced. // Persistent partitions that have recovered from disk will // also need to rebalance primaries return isRebalance || director.isRebalanceNecessary( leaderRegion.getRedundancyProvider().isRedundancyImpaired(), leaderRegion.getDataPolicy().withPersistence()); }
private PartitionedRegion mockPR(String name) { PartitionedRegion region = mock(PartitionedRegion.class); when(region.getFullPath()).thenReturn(name); when(region.getPartitionAttributes()).thenReturn(new PartitionAttributesFactory<>().create()); when(region.getTotalNumberOfBuckets()).thenReturn(113); when(region.getDataPolicy()).thenReturn(DataPolicy.PARTITION); return region; }
/** * Retrieve the set of members which are currently offline for all buckets. */ public OfflineMemberDetailsImpl fetchOfflineMembers() { ProxyBucketRegion[] proxyBuckets = prRegion.getRegionAdvisor().getProxyBucketArray(); Set<PersistentMemberID>[] offlineMembers = new Set[proxyBuckets.length]; for (int i = 0; i < proxyBuckets.length; i++) { ProxyBucketRegion proxy = proxyBuckets[i]; if (this.prRegion.getDataPolicy().withPersistence()) { Set<PersistentMemberID> persistedMembers = proxy.getPersistenceAdvisor().getMissingMembers(); if (persistedMembers == null) { persistedMembers = Collections.emptySet(); } offlineMembers[i] = persistedMembers; } else { offlineMembers[i] = Collections.emptySet(); } } return new OfflineMemberDetailsImpl(offlineMembers); }
String.format( "Data Store on this vm is null and the local max Memory is not zero, the data policy is %s and the localMaxMemeory is : %s", getDataPolicy(), (long) getLocalMaxMemory()));
/** * Wait for in an progress backup. When we backup the whole DS, we need to make sure we don't miss * a bucket because it is in the process of rebalancing. This doesn't wait for the whole backup to * complete, it only makes sure that this destroy will wait until the point when we know that we * that this bucket won't be destroyed on this member in the backup unless it was backed up on the * target member. */ private void waitForInProgressBackup() { BackupService backupService = getPartitionedRegion().getGemFireCache().getBackupService(); if (getPartitionedRegion().getDataPolicy().withPersistence()) { backupService.waitForBackup(); } }
public void recoverFromDiskRecursively() { recoverFromDisk(); List<PartitionedRegion> colocatedWithList = ColocationHelper.getColocatedChildRegions(partitionedRegion); for (PartitionedRegion childPR : colocatedWithList) { if (childPR.getDataPolicy().withPersistence()) { ProxyBucketRegion[] childBucketArray = childPR.getRegionAdvisor().getProxyBucketArray(); if (childBucketArray != null) { ProxyBucketRegion childBucket = childBucketArray[getBucketId()]; childBucket.recoverFromDisk(); } } } }
profile.isPersistent = getDataPolicy().withPersistence(); profile.dataPolicy = getDataPolicy(); profile.hasCacheLoader = basicGetLoader() != null; profile.hasCacheWriter = basicGetWriter() != null; profile.asyncEventQueueIds = getVisibleAsyncEventQueueIds(); if (getDataPolicy().withPersistence()) { profile.persistentID = getDiskStore().generatePersistentID(null);
when(queueRegion.getDataPolicy()).thenReturn(DataPolicy.PARTITION);
if (!colocatedPR.getDataPolicy().withPersistence()) { throw new IllegalStateException( "Cannot colocate a persistent region with a non persistent region");
private void createAndValidatePersistentConfig() { DiskStoreImpl diskStore = this.getDiskStore(); if (this.getDataPolicy().withPersistence() && !this.getConcurrencyChecksEnabled() && supportsConcurrencyChecks()) { logger.info( this.setConcurrencyChecksEnabled(true); if (diskStore != null && this.getDataPolicy().withPersistence()) { String colocatedWith = colocatedWithRegion == null ? "" : colocatedWithRegion.getFullPath(); PRPersistentConfig config = diskStore.getPersistentPRConfig(this.getFullPath());
&& partitionedRegion.getDataPolicy() == DataPolicy.PERSISTENT_PARTITION) { int numBuckets = partitionedRegion.getTotalNumberOfBuckets(); Map<InternalDistributedMember, PersistentMemberID>[] bucketMaps = new Map[numBuckets];
ColocationHelper.getColocatedRegion(this.partitionedRegion); if (this.partitionedRegion.getDataPolicy().withPersistence() && !colocatedRegion.getDataPolicy().withPersistence()) { result = colocatedRegion.getDataStore().grabBucket(bid, getDistributionManager().getDistributionManagerId(), true, true, false, null,
&& !this.getEvictionAttributes().getAlgorithm().isNone() && this.getEvictionAttributes().getAction().isOverflowToDisk()) || this.getDataPolicy().withPersistence()) { StatisticsFactory sf = this.getCache().getDistributedSystem(); this.diskRegionStats = new DiskRegionStats(sf, getFullPath()); if (getDataPolicy().withPersistence()) { startPersistenceProfileLogging();
if (this.partitionedRegion.getDataPolicy().withPersistence()) {