public Map<Integer, SizeEntry> getSizeForLocalPrimaryBuckets() { return getSizeLocallyForBuckets(getAllLocalPrimaryBucketIds()); }
public Map<Integer, SizeEntry> getSizeEstimateForLocalPrimaryBuckets() { return getSizeEstimateLocallyForBuckets(getAllLocalPrimaryBucketIds()); }
public static Set<Integer> getAllPrimaryBucketsOnTheNode(String regionName) { PartitionedRegion region = (PartitionedRegion) cache.getRegion(regionName); return region.getDataStore().getAllLocalPrimaryBucketIds(); }
@Test public void createLuceneIndexOnExistingRegionShouldNotThrowNPEIfBucketMovedDuringReindexing() { LuceneIndexImpl index = mock(LuceneIndexImpl.class); PartitionedRegionDataStore dataStore = mock(PartitionedRegionDataStore.class); when(region.getDataStore()).thenReturn(dataStore); Integer bucketIds[] = {1, 2, 3, 4, 5}; Set<Integer> primaryBucketIds = new HashSet(Arrays.asList(bucketIds)); when(dataStore.getAllLocalPrimaryBucketIds()).thenReturn(primaryBucketIds); when(dataStore.getLocalBucketById(3)).thenReturn(null); boolean result = service.createLuceneIndexOnDataRegion(region, index); assertTrue(result); }
/** * Given a partitioned Region return a Region providing read access to primary copy of the data * which is limited to the local heap, writes using this Region have no constraints and behave the * same as a partitioned Region.<br> * * @param r a partitioned region * @throws IllegalStateException if the provided region is something other than a * {@linkplain DataPolicy#PARTITION partitioned Region} * @return a Region for efficient reads * @since GemFire 6.5 */ public static <K, V> Region<K, V> getLocalPrimaryData(final Region<K, V> r) { if (isPartitionedRegion(r)) { PartitionedRegion pr = (PartitionedRegion) r; final Set<Integer> buckets; if (pr.getDataStore() != null) { buckets = pr.getDataStore().getAllLocalPrimaryBucketIds(); } else { buckets = Collections.emptySet(); } return new LocalDataSet(pr, buckets); } else if (r instanceof LocalDataSet) { return r; } else { throw new IllegalArgumentException( String.format("Region %s is not a Partitioned Region", r.getFullPath())); } }
Set<Integer> primaryBucketIds = userRegion.getDataStore().getAllLocalPrimaryBucketIds(); Iterator primaryBucketIterator = primaryBucketIds.iterator(); while (primaryBucketIterator.hasNext()) {
ValuesSet vSet = new ValuesSet(this.getDataStore().getAllLocalPrimaryBucketIds()); Iterator itr = vSet.iterator(); while (itr.hasNext()) {
bucketSet.add(1); when(mockPartitionedRegionDataStore.getAllLocalPrimaryBucketIds()).thenReturn(bucketSet);
@Override public boolean isIndexingInProgress() { PartitionedRegion userRegion = (PartitionedRegion) cache.getRegion(this.getRegionPath()); Set<Integer> fileRegionPrimaryBucketIds = this.getFileAndChunkRegion().getDataStore().getAllLocalPrimaryBucketIds(); for (Integer bucketId : fileRegionPrimaryBucketIds) { BucketRegion userBucket = userRegion.getDataStore().getLocalBucketById(bucketId); if (!userBucket.isEmpty() && !this.isIndexAvailable(bucketId)) { return true; } } return false; }