private Map<PartitionedRegion, InternalPRInfo> fetchDetails(InternalCache cache) { LoadProbe probe = cache.getInternalResourceManager().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 boolean operateOnPartitionedRegion(ClusterDistributionManager 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; }
/** * 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 * @return true if the redundant bucket was created */ public boolean createRedundantBucketForRegion(InternalDistributedMember target, int bucketId) { return getLeaderRegion().getRedundancyProvider().createBackupBucketOnMember(bucketId, target, isRebalance, replaceOfflineData, null, true); }
earlySufficientStoresCheck(partitionName); ArrayListWithClearState<InternalDistributedMember> failedMembers = new ArrayListWithClearState<InternalDistributedMember>(); final long timeOut = System.currentTimeMillis() + computeTimeout(); BucketMembershipObserver observer = null; boolean needToElectPrimary = true; timedOut(this.prRegion, getAllStores(partitionName), acceptedMembers, ALLOCATE_ENOUGH_MEMBERS_TO_HOST_BUCKET, computeTimeout()); Set<InternalDistributedMember> allStores = getAllStores(partitionName); loggedInsufficentStores = checkSufficientStores(allStores, loggedInsufficentStores); InternalDistributedMember candidate = createBucketInstance(bucketId, newBucketSize, excludedMembers, acceptedMembers, failedMembers, timeOut, allStores); if (candidate != null) { Set<InternalDistributedMember> exm = getBuddyMembersInZone(candidate, allStores); exm.remove(candidate); exm.removeAll(acceptedMembers); verifyBucketNodes(excludedMembers, partitionName); insufficientStores(allStores, acceptedMembers, true); endBucketCreation(bucketId, acceptedMembers, bucketPrimary, partitionName);
ret = this.redundancyProvider.createBucketAtomically(bucketId, size, startTime, false, partitionName); } else { ret = this.redundancyProvider.createBucketOnDataStore(bucketId, size, startTime, snoozer);
public void finishIncompleteBucketCreation(int bucketId) { String partitionName = null; final long startTime = PartitionedRegionStats.startTime(); if (this.prRegion.isFixedPartitionedRegion()) { FixedPartitionAttributesImpl fpa = PartitionedRegionHelper.getFixedPartitionAttributesForBucket(this.prRegion, bucketId); partitionName = fpa.getPartitionName(); } createBucketAtomically(bucketId, 0, startTime, true, partitionName); }
this.redundancyProvider = new PRHARedundancyProvider(this);
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); } } } }
private static void fillInPartitionedRegionInfo(final InternalCache cache, final Set prDetailsSet, final boolean internal) { // TODO: optimize by fetching all PR details from each member at once Set<PartitionedRegion> partitionedRegions = cache.getPartitionedRegions(); if (partitionedRegions.isEmpty()) { return; } for (PartitionedRegion partitionedRegion : partitionedRegions) { PartitionRegionInfo prDetails = partitionedRegion.getRedundancyProvider() .buildPartitionedRegionInfo(internal, cache.getInternalResourceManager().getLoadProbe()); if (prDetails != null) { prDetailsSet.add(prDetails); } } }
boolean fetchOfflineMembers = false; if (ds != null) { memberDetails.add(buildPartitionMemberDetails(internal, loadProbe)); offlineMembers = fetchOfflineMembers(); } else { fetchOfflineMembers = true;
InternalDistributedMember primary = r.getRedundancyProvider().createBucketAtomically(bucketId, bucketSize, startTime, false, partitionName); r.getPrStats().endPartitionMessagesProcessing(startTime);
@Override public Map<PartitionedRegion, InternalPRInfo> getRegionMemberDetails() { InternalCache cache = getCache(); Map<PartitionedRegion, InternalPRInfo> detailsMap = new HashMap<>(); for (PartitionedRegion region : cache.getPartitionedRegions()) { LoadProbe probe = cache.getInternalResourceManager().getLoadProbe(); InternalPRInfo info = region.getRedundancyProvider().buildPartitionedRegionInfo(true, probe); detailsMap.put(region, info); } return detailsMap; }
when(mockR1.getRedundancyProvider()).thenReturn(mockRedundancyProviderR1); when(mockR2.getRedundancyProvider()).thenReturn(mockRedundancyProviderR2); when(mockRedundancyProviderR1.buildPartitionedRegionInfo(eq(true), any(LoadProbe.class))) .thenReturn(mockR1PRInfo); when(mockRedundancyProviderR2.buildPartitionedRegionInfo(eq(true), any(LoadProbe.class))) .thenReturn(mockR2PRInfo);
/** * 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 GemFire 6.0 */ public static PartitionRegionInfo getPartitionRegionInfo(final Region<?, ?> region) { try { PartitionedRegion partitionedRegion = isPartitionedCheck(region); InternalCache cache = (InternalCache) region.getCache(); return partitionedRegion.getRedundancyProvider().buildPartitionedRegionInfo(false, cache.getInternalResourceManager().getLoadProbe()); } catch (ClassCastException ignore) { // not a PR so return null } return null; }