/** * Create a redundant bucket on the target member * * @param target * the member on which to create the redundant bucket * @param bucketId * the identifier of the bucket * @param pr * the partitioned region which contains the bucket * @param forRebalance * true if part of a rebalance operation * @return true if the redundant bucket was created */ public static boolean createRedundantBucketForRegion( InternalDistributedMember target, int bucketId, PartitionedRegion pr, boolean forRebalance, boolean replaceOfflineData) { return pr.getRedundancyProvider().createBackupBucketOnMember(bucketId, target, forRebalance, replaceOfflineData,null, true); }
private static void fillInPartitionedRegionInfo(GemFireCacheImpl cache, final Set prDetailsSet, final boolean internal) { // TODO: optimize by fetching all PR details from each member at once Set<PartitionedRegion> prSet = cache.getPartitionedRegions(); if (prSet.isEmpty()) { return; } for (Iterator<PartitionedRegion> iter = prSet.iterator(); iter.hasNext();) { PartitionedRegion pr = iter.next(); PartitionRegionInfo prDetails = pr.getRedundancyProvider(). buildPartitionedRegionInfo(internal, cache.getResourceManager().getLoadProbe()); if (prDetails != null) { prDetailsSet.add(prDetails); } } }
private Map<PartitionedRegion, InternalPRInfo> fetchDetails( GemFireCacheImpl cache) { LoadProbe probe = cache.getResourceManager().getLoadProbe(); Map<PartitionedRegion, InternalPRInfo> detailsMap = new LinkedHashMap<PartitionedRegion, InternalPRInfo>( colocatedRegions.size()); for (PartitionedRegion colocatedRegion: colocatedRegions) { if (ColocationHelper.isColocationComplete(colocatedRegion)) { InternalPRInfo info = colocatedRegion.getRedundancyProvider().buildPartitionedRegionInfo(true, probe); detailsMap.put(colocatedRegion, info); } } return detailsMap; }
public boolean isPersistentRecoveryComplete() { if(!ColocationHelper.checkMembersColocation(this.prRegion, this.prRegion.getMyId())) { return false; } if(allBucketsRecoveredFromDisk != null && allBucketsRecoveredFromDisk.getCount() > 0) { return false; } Map<String, PartitionedRegion> colocatedRegions = ColocationHelper.getAllColocationRegions(this.prRegion); for(PartitionedRegion region : colocatedRegions.values()) { PRHARedundancyProvider redundancyProvider = region.getRedundancyProvider(); if(redundancyProvider.allBucketsRecoveredFromDisk != null && redundancyProvider.allBucketsRecoveredFromDisk.getCount() > 0) { return false; } } return true; }
public boolean isPersistentRecoveryComplete() { if(!ColocationHelper.checkMembersColocation(this.prRegion, this.prRegion.getMyId())) { return false; } if(allBucketsRecoveredFromDisk != null && allBucketsRecoveredFromDisk.getCount() > 0) { return false; } Map<String, PartitionedRegion> colocatedRegions = ColocationHelper.getAllColocationRegions(this.prRegion); for(PartitionedRegion region : colocatedRegions.values()) { PRHARedundancyProvider redundancyProvider = region.getRedundancyProvider(); if(redundancyProvider.allBucketsRecoveredFromDisk != null && redundancyProvider.allBucketsRecoveredFromDisk.getCount() > 0) { return false; } } return true; }
private static void fillInPartitionedRegionInfo(GemFireCacheImpl cache, final Set prDetailsSet, final boolean internal) { // TODO: optimize by fetching all PR details from each member at once Set<PartitionedRegion> prSet = cache.getPartitionedRegions(); if (prSet.isEmpty()) { return; } for (Iterator<PartitionedRegion> iter = prSet.iterator(); iter.hasNext();) { PartitionedRegion pr = iter.next(); PartitionRegionInfo prDetails = pr.getRedundancyProvider(). buildPartitionedRegionInfo(internal, cache.getResourceManager().getLoadProbe()); if (prDetails != null) { prDetailsSet.add(prDetails); } } }
private Map<PartitionedRegion, InternalPRInfo> fetchDetails( GemFireCacheImpl cache) { LoadProbe probe = cache.getResourceManager().getLoadProbe(); Map<PartitionedRegion, InternalPRInfo> detailsMap = new LinkedHashMap<PartitionedRegion, InternalPRInfo>( colocatedRegions.size()); for (PartitionedRegion colocatedRegion: colocatedRegions) { if (ColocationHelper.isColocationComplete(colocatedRegion)) { InternalPRInfo info = colocatedRegion.getRedundancyProvider().buildPartitionedRegionInfo(true, probe); detailsMap.put(colocatedRegion, info); } } return detailsMap; }
@Override protected final boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion region, long startTime) throws ForceReattemptException { // this is executing in the WAITING_POOL_EXECUTOR try { region.getRedundancyProvider().endBucketCreationLocally(bucketId, newPrimary); } finally { region.getPrStats().endPartitionMessagesProcessing(startTime); } return false; }
/** * Check that sender is still a participant in the partitioned region. If not, * notify other nodes to create backup buckets */ private void checkSenderStillAlive(PartitionedRegion r, InternalDistributedMember sender) { if (!r.getDistributionAdvisor().containsId(sender)) { r.getRedundancyProvider().finishIncompleteBucketCreation(this.bucketId); } }
public void run() { getBucket().getPartitionedRegion().getRedundancyProvider().finishIncompleteBucketCreation(getBucket().getId()); } });
public void run() { getBucket().getPartitionedRegion().getRedundancyProvider().finishIncompleteBucketCreation(getBucket().getId()); } });
/** * Check that sender is still a participant in the partitioned region. If not, * notify other nodes to create backup buckets */ private void checkSenderStillAlive(PartitionedRegion r, InternalDistributedMember sender) { if (!r.getDistributionAdvisor().containsId(sender)) { r.getRedundancyProvider().finishIncompleteBucketCreation(this.bucketId); } }
@Override protected final boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion region, long startTime) throws ForceReattemptException { // this is executing in the WAITING_POOL_EXECUTOR try { region.getRedundancyProvider().endBucketCreationLocally(bucketId, newPrimary); } finally { region.getPrStats().endPartitionMessagesProcessing(startTime); } return false; }
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 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()); }
@Override protected final boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion region, long startTime) throws ForceReattemptException { PartitionMemberInfoImpl details = (PartitionMemberInfoImpl) region.getRedundancyProvider().buildPartitionMemberDetails( this.internal, this.loadProbe); OfflineMemberDetails offlineDetails; if(this.internal && this.fetchOfflineMembers) { offlineDetails = region.getRedundancyProvider().fetchOfflineMembers(); } else { offlineDetails = new OfflineMemberDetailsImpl(new Set[0]); } region.getPrStats().endPartitionMessagesProcessing(startTime); FetchPartitionDetailsReplyMessage.send( getSender(), getProcessorId(), details, dm, offlineDetails, null); // Unless there was an exception thrown, this message handles sending the // response return false; }
@Override protected final boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion region, long startTime) throws ForceReattemptException { PartitionMemberInfoImpl details = (PartitionMemberInfoImpl) region.getRedundancyProvider().buildPartitionMemberDetails( this.internal, this.loadProbe); OfflineMemberDetails offlineDetails; if(this.internal && this.fetchOfflineMembers) { offlineDetails = region.getRedundancyProvider().fetchOfflineMembers(); } else { offlineDetails = new OfflineMemberDetailsImpl(new Set[0]); } region.getPrStats().endPartitionMessagesProcessing(startTime); FetchPartitionDetailsReplyMessage.send( getSender(), getProcessorId(), details, dm, offlineDetails, null); // Unless there was an exception thrown, this message handles sending the // response return false; }
/** * Gathers details about the specified partitioned region. Returns null if * the partitioned region is not locally defined. * * @param region the region to get info about * @return details about the specified partitioned region * @since 6.0 */ public static PartitionRegionInfo getPartitionRegionInfo( final Region<?,?> region) { try { PartitionedRegion pr = isPartitionedCheck(region); GemFireCacheImpl cache = (GemFireCacheImpl) region.getCache(); return pr.getRedundancyProvider().buildPartitionedRegionInfo( false, cache.getResourceManager().getLoadProbe()); // may return null } catch (ClassCastException e) { // not a PR so return null } return null; }
/** * Gathers details about the specified partitioned region. Returns null if * the partitioned region is not locally defined. * * @param region the region to get info about * @return details about the specified partitioned region * @since 6.0 */ public static PartitionRegionInfo getPartitionRegionInfo( final Region<?,?> region) { try { PartitionedRegion pr = isPartitionedCheck(region); GemFireCacheImpl cache = (GemFireCacheImpl) region.getCache(); return pr.getRedundancyProvider().buildPartitionedRegionInfo( false, cache.getResourceManager().getLoadProbe()); // may return null } catch (ClassCastException e) { // not a PR so return null } return null; }
protected void createMissingBuckets(PartitionedRegion region) { PartitionedRegion parentRegion = ColocationHelper.getColocatedRegion(region); if(parentRegion == null) { return; } // Fix for 48954 - Make sure the parent region has created missing buckets // before we create missing buckets for this child region. createMissingBuckets(parentRegion); for (int i = 0; i < region .getTotalNumberOfBuckets(); i++) { if(parentRegion.getRegionAdvisor().getBucketAdvisor(i) .getBucketRedundancy() != region.getRegionAdvisor().getBucketAdvisor(i).getBucketRedundancy()){ /*if (leaderRegion.getRegionAdvisor().isStorageAssignedForBucket(i)) {*/ final long startTime = PartitionedRegionStats.startTime(); region.getRedundancyProvider().createBucketAtomically(i, 0, startTime, true, null); } } } }