@Override public PartitionAttributes getPartitionAttributes() { return this.ra.getPartitionAttributes(); }
/** * This method initializes the partitionedRegionDataStore for this PR. * * @param ra Region attributes */ private void initializeDataStore(RegionAttributes ra) { this.dataStore = PartitionedRegionDataStore.createDataStore(cache, this, ra.getPartitionAttributes()); }
protected AsyncEventQueue createAEQ(RegionAttributes attributes, String aeqId) { if (attributes.getPartitionAttributes() != null) { if (attributes.getPartitionAttributes().getLocalMaxMemory() == 0) { // accessor will not create AEQ return null; } } return createAEQ(createAEQFactory(attributes), aeqId); }
@Override protected boolean usesDiskStore(RegionAttributes regionAttributes) { if (regionAttributes.getPartitionAttributes().getLocalMaxMemory() <= 0) { return false; // see bug 42055 } return super.usesDiskStore(regionAttributes); }
protected static boolean isLocalAccessor(CacheDistributionAdvisee region) { if (!region.getAttributes().getDataPolicy().withStorage()) { return true; } if (region.getAttributes().getPartitionAttributes() != null && region.getAttributes().getPartitionAttributes().getLocalMaxMemory() == 0) { return true; } return false; }
private Region initializeScenario(final boolean withPersistence, final String regionPath, final Cache cache, int localMaxMemory) { PartitionedRegion region = mock(PartitionedRegion.class); PartitionAttributes partitionAttributes = new PartitionAttributesFactory() .setLocalMaxMemory(localMaxMemory).setTotalNumBuckets(103).create(); RegionAttributes regionAttributes = spy(createRegionAttributes(withPersistence, partitionAttributes)); ExtensionPoint extensionPoint = mock(ExtensionPoint.class); when(cache.getRegion(regionPath)).thenReturn(region); when(cache.getRegionAttributes(any())).thenReturn(regionAttributes); when(region.getAttributes()).thenReturn(regionAttributes); when(regionAttributes.getPartitionAttributes()).thenReturn(partitionAttributes); when(region.getPartitionAttributes()).thenReturn(partitionAttributes); when(region.getExtensionPoint()).thenReturn(extensionPoint); return region; }
final PartitionAttributes userPA = pr.getAttributes().getPartitionAttributes();
/** * Note: hydra invokes this with setRefid=false. */ public void setAttributes(RegionAttributes attrs, boolean setRefid) { this.hasAttributes = true; if (attrs instanceof RegionAttributesCreation) { this.attrs = (RegionAttributesCreation) attrs; } else { this.attrs = new RegionAttributesCreation(this.cache, attrs, false); } if ((setRefid && (this.attrs.getRefid() == null))) { this.attrs.setRefid(getRefid()); } if (attrs.getPartitionAttributes() != null && attrs.getEvictionAttributes() != null && attrs.getEvictionAttributes().getAlgorithm().isLRUMemory() && attrs.getPartitionAttributes().getLocalMaxMemory() != 0 && attrs.getEvictionAttributes() .getMaximum() != attrs.getPartitionAttributes().getLocalMaxMemory()) { getCache().getLogger().warning(String.format( "For region %s with data policy PARTITION, memory LRU eviction attribute maximum has been reset from %sMB to local-max-memory %sMB", new Object[] {this.getName(), attrs.getEvictionAttributes().getMaximum(), attrs.getPartitionAttributes().getLocalMaxMemory()})); this.attrs.setEvictionAttributes(attrs.getEvictionAttributes().createLRUMemoryAttributes( attrs.getPartitionAttributes().getLocalMaxMemory(), attrs.getEvictionAttributes().getObjectSizer(), attrs.getEvictionAttributes().getAction())); } }
public synchronized void initializeRegionAdvisor() { if (this.buckets != null) { return; } PartitionedRegion p = getPartitionedRegion(); int numBuckets = p.getAttributes().getPartitionAttributes().getTotalNumBuckets(); ProxyBucketRegion[] bucs = new ProxyBucketRegion[numBuckets]; InternalRegionArguments args = new InternalRegionArguments(); args.setPartitionedRegionAdvisor(this); for (int i = 0; i < bucs.length; i++) { bucs[i] = new ProxyBucketRegion(i, p, args); bucs[i].initialize(); } this.buckets = bucs; }
public void addRegion(Region region) { if (region.getAttributes().getPartitionAttributes() != null) { addPartionRegionStats(((PartitionedRegion) region).getPrStats()); } InternalRegion internalRegion = (InternalRegion) region; addLRUStats(internalRegion.getEvictionStatistics()); DiskRegion dr = internalRegion.getDiskRegion(); if (dr != null) { for (DirectoryHolder dh : dr.getDirectories()) { addDirectoryStats(dh.getDiskDirectoryStats()); } } }
public void testRegionIdleDestroy() throws CacheException, InterruptedException { if (getRegionAttributes().getPartitionAttributes() != null) return;
public void removeRegion(Region region) { if (region.getAttributes().getPartitionAttributes() != null) { removePartionRegionStats(((PartitionedRegion) region).getPrStats()); } LocalRegion l = (LocalRegion) region; removeLRUStats(l.getEvictionStatistics()); DiskRegion dr = l.getDiskRegion(); if (dr != null) { for (DirectoryHolder dh : dr.getDirectories()) { removeDirectoryStats(dh.getDiskDirectoryStats()); } } }
public void testRegionTtlInvalidate() throws CacheException, InterruptedException { if (getRegionAttributes().getPartitionAttributes() != null) return;
void validateColocation() { final PartitionAttributesImpl userPA = (PartitionAttributesImpl) pr.getAttributes().getPartitionAttributes();
public void testRegionTtlDestroy() throws CacheException, InterruptedException { if (getRegionAttributes().getPartitionAttributes() != null) return;
@Override public void execute(final FunctionContext context) { InternalCache cache = (InternalCache) context.getCache(); QueryService queryService = cache.getQueryService(); String qstr = (String) context.getArguments(); Region r = cache.getRegion(regionName); try { Query query = queryService.newQuery(qstr); SelectResults sr; if (r.getAttributes().getPartitionAttributes() != null && showMembers) { sr = (SelectResults) query.execute((RegionFunctionContext) context); context.getResultSender().lastResult(sr.asList()); } else { sr = (SelectResults) query.execute(); context.getResultSender().lastResult(sr.asList()); } } catch (Exception e) { throw new FunctionException(e); } }
private AsyncEventQueueFactoryImpl createAEQFactory(final RegionAttributes attributes) { AsyncEventQueueFactoryImpl factory = (AsyncEventQueueFactoryImpl) cache.createAsyncEventQueueFactory(); if (attributes.getPartitionAttributes() != null) { factory.setParallel(true); // parallel AEQ for PR } else { factory.setParallel(false); // TODO: not sure if serial AEQ working or not } factory.setMaximumQueueMemory(1000); factory.setDispatcherThreads(10); factory.setBatchSize(1000); factory.setIsMetaQueue(true); if (attributes.getDataPolicy().withPersistence()) { factory.setPersistent(true); } factory.setDiskStoreName(attributes.getDiskStoreName()); factory.setDiskSynchronous(true); factory.setForwardExpirationDestroy(true); return factory; }
@Test public void testRegionExpirationAfterMutate() throws CacheException, InterruptedException { if (getRegionAttributes().getPartitionAttributes() != null) { return;
final boolean withPersistence = withPersistence(); RegionAttributes regionAttributes = dataRegion.getAttributes(); final boolean withStorage = regionAttributes.getPartitionAttributes().getLocalMaxMemory() > 0;
public static <K, V> RegionMBeanBridge<K, V> getInstance(Region<K, V> region) { if (region.getAttributes().getPartitionAttributes() != null) { RegionMBeanBridge<K, V> bridge = PartitionedRegionBridge.getInstance(region); PartitionedRegion parRegion = ((PartitionedRegion) region); DiskStoreImpl dsi = parRegion.getDiskStore(); if (dsi != null) { DiskRegionStats stats = parRegion.getDiskRegionStats(); DiskRegionBridge diskRegionBridge = new DiskRegionBridge(stats); bridge.addDiskRegionBridge(diskRegionBridge); for (DirectoryHolder dh : dsi.getDirectoryHolders()) { diskRegionBridge.addDirectoryStats(dh.getDiskDirectoryStats()); } bridge.addDiskRegionBridge(diskRegionBridge); } return bridge; } else { RegionMBeanBridge<K, V> bridge = new RegionMBeanBridge<K, V>(region); LocalRegion localRegion = ((LocalRegion) region); DiskStoreImpl dsi = localRegion.getDiskStore(); if (dsi != null) { DiskRegionBridge diskRegionBridge = new DiskRegionBridge(localRegion.getDiskRegion().getStats()); bridge.addDiskRegionBridge(diskRegionBridge); for (DirectoryHolder dh : dsi.getDirectoryHolders()) { diskRegionBridge.addDirectoryStats(dh.getDiskDirectoryStats()); } } return bridge; } }