@Override public CachePerfStats getRegionPerfStats() { PartitionedRegionDataStore ds = getDataStore(); CachePerfStats result = null; if (ds != null) { // If we don't have a data store (we are an accessor) // then we do not have per region stats. // This is not good. We should still have stats even for accessors. result = ds.getCachePerfStats(); // fixes 46692 } return result; }
private boolean areLocalBucketQueueRegionsPresent() { boolean bucketsAvailable = false; for (PartitionedRegion prQ : this.userRegionNameToshadowPRMap.values()) { if (prQ.getDataStore().getAllLocalBucketRegions().size() > 0) return true; } return false; }
public Object call() { PartitionedRegion pr = (PartitionedRegion) getCache().getRegion(regionPath); PartitionedRegionDataStore ds = pr.getDataStore(); if (ds == null) { return Long.valueOf(0); } else { return Long.valueOf(getSize(ds)); } } })).longValue();
public void run() { PartitionedRegion region = (PartitionedRegion) basicGetCache().getRegion(OrderPartitionedRegionName); MyResourceObserver observer = (MyResourceObserver) InternalResourceManager.getResourceObserver(); try { observer.waitForRegion(region, 60 * 1000); } catch (InterruptedException e) { throw new RuntimeException(e); } assertEquals(2, region.getDataStore().getAllLocalBucketIds().size()); assertEquals(2, region.getDataStore().getAllLocalPrimaryBucketIds().size()); } };
public void run() { PartitionedRegion region1 = (PartitionedRegion) basicGetCache().getRegion(CustomerPartitionedRegionName); MyResourceObserver observer = (MyResourceObserver) InternalResourceManager.getResourceObserver(); try { observer.waitForRegion(region1, 60 * 1000); } catch (InterruptedException e) { throw new RuntimeException(e); } assertEquals(0, region1.getDataStore().getAllLocalBucketIds().size()); assertEquals(0, region1.getDataStore().getAllLocalPrimaryBucketIds().size()); } };
private StoppableReadLock getParentBucketCreationLock() { PartitionedRegion colocatedRegion = ColocationHelper.getColocatedRegion(this.partitionedRegion); StoppableReadLock parentLock = null; if (colocatedRegion != null) { parentLock = colocatedRegion.getDataStore().bucketCreationLock.readLock(); return parentLock; } return null; }
@Override public int size() { int size = 0; for (Integer bId : buckets) { BucketRegion br = proxy.getDataStore().getLocalBucketById(bId); size+=br.size(); } return size; }
public Object call() throws Exception { Cache cache = getCache(); PartitionedRegion region = (PartitionedRegion) cache.getRegion(regionName); return new TreeSet<Integer>(region.getDataStore().getAllLocalBucketIds()); } };
private HoplogOrganizer getOrganizer(PartitionedRegion region, int bucketId) { BucketRegion br = region.getDataStore().getLocalBucketById(bucketId); if (br == null) { // got rebalanced or something throw new PrimaryBucketException("Bucket region is no longer available " + bucketId + region); } return br.getHoplogOrganizer(); } }
@Override public void destroyOnRemote(EntryEventImpl event, boolean cacheWrite, Object expectedOldValue) throws DataLocationException { PartitionedRegion pr = (PartitionedRegion)event.getLocalRegion(); pr.getDataStore().destroyLocally(event.getBucketId(), event, expectedOldValue); return; }
@Override public EntryExpiryTask getEntryExpiryTask(Object key) { BucketRegion br = this.getDataStore().getLocalBucketByKey(key); if (br == null) { throw new EntryNotFoundException("Bucket for key " + key + " does not exist."); } return br.getEntryExpiryTask(key); } }
public void run() { Cache cache = getCache(); PartitionedRegion region = (PartitionedRegion) cache.getRegion(PR_REGION_NAME); region.getDataStore().moveBucket(bucketId, sourceId,false); } };
public Object call() throws Exception { Cache c = getCache(); PartitionedRegion pr = (PartitionedRegion) c.getRegion(prPrefix); assertNotNull(pr); assertEquals(0, pr.getDataStore().getBucketsManaged()); return Boolean.TRUE; } };
@Override public boolean putEntryOnRemote(EntryEventImpl event, boolean ifNew, boolean ifOld, Object expectedOldValue, boolean requireOldValue, boolean cacheWrite, long lastModified, boolean overwriteDestroyed) throws DataLocationException { PartitionedRegion pr = (PartitionedRegion)event.getLocalRegion(); return pr.getDataStore().putLocally(event.getBucketId(), event, ifNew, ifOld, expectedOldValue, requireOldValue, lastModified); }
private Set<InternalDistributedMember> getAllStores(String partitionName) { if(partitionName != null){ return getFixedPartitionStores(partitionName); } final Set<InternalDistributedMember> allStores = this.prRegion.getRegionAdvisor().adviseDataStore(true); PartitionedRegionDataStore myDS = this.prRegion.getDataStore(); if (myDS != null) { allStores.add(this.prRegion.getDistributionManager().getId()); } return allStores; }
private HoplogOrganizer getOrganizer(PartitionedRegion region, int bucketId) { BucketRegion br = region.getDataStore().getLocalBucketById(bucketId); if (br == null) { // got rebalanced or something throw new BucketMovedException("Bucket region is no longer available", bucketId, region.getName()); } return br.getHoplogOrganizer(); }
private HoplogOrganizer getOrganizer(PartitionedRegion region, int bucketId) { BucketRegion br = region.getDataStore().getLocalBucketById(bucketId); if (br == null) { // got rebalanced or something throw new BucketMovedException("Bucket region is no longer available. BucketId: "+ bucketId + " HdfsRegion: " + region.getName()); } return br.getHoplogOrganizer(); }
@Override public void invalidateOnRemote(EntryEventImpl event, boolean invokeCallbacks, boolean forceNewEntry) throws DataLocationException { PartitionedRegion pr = (PartitionedRegion)event.getLocalRegion(); pr.getDataStore().invalidateLocally(event.getKeyInfo().getBucketId(), event); } @Override
protected boolean includePartitionedRegion(PartitionedRegion region) { return (region.getEvictionAttributes().getAlgorithm().isLRUHeap() && (region.getDataStore() != null) && !region.getAttributes().getEnableOffHeapMemory()); }
@Override protected final boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion region, long startTime) throws ForceReattemptException { PartitionedRegionDataStore dataStore = region.getDataStore(); boolean moved = dataStore.moveBucket(this.bucketId, this.source,true); region.getPrStats().endPartitionMessagesProcessing(startTime); MoveBucketReplyMessage.send( getSender(), getProcessorId(), dm, null, moved); return false; }