public void run() { Cache cache = getCache(); PartitionedRegion partitionedregion = (PartitionedRegion) cache.getRegion(PR_PREFIX); long bytes = partitionedregion.getDataStore().getBucketSize(0); assertEquals(50 * oneItemSize.longValue(), bytes); } });
public Object call() { GemFireCacheImpl cache = (GemFireCacheImpl) getCache(); PartitionedRegion region = (PartitionedRegion) cache.getRegion("region1"); long size = region.getDataStore().getBucketSize(0); TestDelta value = (TestDelta) region.get(Integer.valueOf(0)); value.checkFields(serializations, deserializations, deltas, clones); return Long.valueOf(size); } };
public void run() throws CacheException { Cache cache = getCache(); PartitionedRegion partitionedregion = (PartitionedRegion) cache.getRegion(PR_PREFIX); PartitionedRegionDataStore dataStore = partitionedregion.getDataStore(); //there should only be 2 items in memory assertEquals(2 * oneItemSize, dataStore.currentAllocatedMemory()); //fault something else into memory and check again. partitionedregion.get(Long.valueOf(82 * totalNumBuckets)); assertEquals(2 * oneItemSize, dataStore.currentAllocatedMemory()); assertEquals(50 * oneItemSize, dataStore.getBucketSize(0)); } };
PartitionedRegionDataStore dataStore = partitionedregion.getDataStore(); partitionedregion.put(Integer.valueOf(0), new byte[100]); long oneItemSize = dataStore.getBucketSize(0); for(int i = 1; i < 100; i++) { partitionedregion.put(Integer.valueOf(i * totalNumBuckets), new byte[100]); assertEquals(100 * oneItemSize, dataStore.getBucketSize(0)); assertEquals(50 * oneItemSize, dataStore.getBucketSize(0)); assertEquals(50 * oneItemSize, dataStore.getBucketSize(0));
public Object call() { GemFireCacheImpl cache = (GemFireCacheImpl) getCache(); PartitionedRegion region = (PartitionedRegion) cache.getRegion("region1"); long size = region.getDataStore().getBucketSize(0); TestDelta value = (TestDelta) region.get(Integer.valueOf(0)); value.checkFields(serializations, deserializations, deltas, clones); return Long.valueOf(size); } };
private long getSize(PartitionedRegionDataStore ds) { long size = 0; int totalNumBuckets = ds.getPartitionedRegion().getPartitionAttributes().getTotalNumBuckets(); for(int i = 0; i < totalNumBuckets; i++) { size += ds.getBucketSize(i); } return size; }
public Object call() { Cache cache = getCache(); LocalRegion region = (LocalRegion) cache.getRegion("region"); if(region instanceof PartitionedRegion) { long total = 0; PartitionedRegion pr = ((PartitionedRegion) region); for(int i =0; i < pr.getPartitionAttributes().getTotalNumBuckets(); i++) { total += pr.getDataStore().getBucketSize(i); } return total; } else { return 0L; } } });
Map.Entry<Integer,Integer> me = iter.next(); int bid = me.getKey().intValue(); long bucketSize = ds.getBucketSize(bid); bucketSizes[bid] = bucketSize; size += bucketSize;
Map.Entry<Integer,Integer> me = iter.next(); int bid = me.getKey().intValue(); long bucketSize = ds.getBucketSize(bid); bucketSizes[bid] = bucketSize; size += bucketSize;
@Override protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion r, long startTime) throws CacheException, ForceReattemptException { PartitionedRegionDataStore ds = r.getDataStore(); final long size; if (ds != null) { size = ds.getBucketSize(bucketId); } else { // sender thought this member had a data store, but it doesn't throw new ForceReattemptException(LocalizedStrings.BucketSizeMessage_NO_DATASTORE_IN_0.toLocalizedString(dm.getDistributionManagerId())); } r.getPrStats().endPartitionMessagesProcessing(startTime); BucketSizeReplyMessage.send(getSender(), getProcessorId(), dm, size); return false; }
@Override protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion r, long startTime) throws CacheException, ForceReattemptException { PartitionedRegionDataStore ds = r.getDataStore(); final long size; if (ds != null) { size = ds.getBucketSize(bucketId); } else { // sender thought this member had a data store, but it doesn't throw new ForceReattemptException(LocalizedStrings.BucketSizeMessage_NO_DATASTORE_IN_0.toLocalizedString(dm.getDistributionManagerId())); } r.getPrStats().endPartitionMessagesProcessing(startTime); BucketSizeReplyMessage.send(getSender(), getProcessorId(), dm, size); return false; }
public PRLoad getLoad(PartitionedRegion pr) { PartitionedRegionDataStore ds = pr.getDataStore(); int configuredBucketCount = pr.getTotalNumberOfBuckets(); PRLoad prLoad = new PRLoad( configuredBucketCount, pr.getLocalMaxMemory()); // key: bid, value: size for(Integer bidInt : ds.getAllLocalBucketIds()) { int bid = bidInt.intValue(); long bucketSize = ds.getBucketSize(bid); if(bucketSize < MIN_BUCKET_SIZE) { bucketSize = MIN_BUCKET_SIZE; } BucketAdvisor bucketAdvisor = pr.getRegionAdvisor(). getBucket(bid).getBucketAdvisor(); //Wait for a primary to exist for this bucket, because //it might be this member. bucketAdvisor.getPrimary(); boolean isPrimary = pr.getRegionAdvisor(). getBucket(bid).getBucketAdvisor().isPrimary(); prLoad.addBucket(bid, bucketSize, isPrimary ? 1 : 0); } return prLoad; }
public PRLoad getLoad(PartitionedRegion pr) { PartitionedRegionDataStore ds = pr.getDataStore(); int configuredBucketCount = pr.getTotalNumberOfBuckets(); PRLoad prLoad = new PRLoad( configuredBucketCount, pr.getLocalMaxMemory()); // key: bid, value: size for(Integer bidInt : ds.getAllLocalBucketIds()) { int bid = bidInt.intValue(); long bucketSize = ds.getBucketSize(bid); if(bucketSize < MIN_BUCKET_SIZE) { bucketSize = MIN_BUCKET_SIZE; } BucketAdvisor bucketAdvisor = pr.getRegionAdvisor(). getBucket(bid).getBucketAdvisor(); //Wait for a primary to exist for this bucket, because //it might be this member. bucketAdvisor.getPrimary(); boolean isPrimary = pr.getRegionAdvisor(). getBucket(bid).getBucketAdvisor().isPrimary(); prLoad.addBucket(bid, bucketSize, isPrimary ? 1 : 0); } return prLoad; }