protected void populateSequentiallyAndEvenly() { int totalNumBuckets = aRegion.getPartitionAttributes().getTotalNumBuckets(); int numEntriesPerBucket = MAX_KEYS_TO_BE_POPULATED / totalNumBuckets; for (int bucketId = 0; bucketId < totalNumBuckets; bucketId++) { populateSpecificBucketSpecificSize(bucketId, numEntriesPerBucket); } }
public void execute(Region region, Integer key) { PartitionedRegion r = (PartitionedRegion) region; //get a key that doesn't exist, but is in the same bucket as the given key region.get(key + r.getPartitionAttributes().getTotalNumBuckets()); } });
protected void populateSequentiallyAndIncrementally() { int totalNumBuckets = aRegion.getPartitionAttributes().getTotalNumBuckets(); // int numEntriesPerBucket = MAX_KEYS_TO_BE_POPULATED/totalNumBuckets; for (int bucketId = 0; bucketId < totalNumBuckets; bucketId++) { populateSpecificBucketSpecificSize(bucketId, bucketId + 10); } }
private void init() { execution = FunctionService.onMembers(region.getCache().getDistributedSystem()); int totalNumBuckets = region.getPartitionAttributes().getTotalNumBuckets(); routingKeySet = new CopyOnWriteArraySet(); for (int i = 0; i < totalNumBuckets; i++) { routingKeySet.add(i); } }
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; }
/** * This task is done once the regions are populated till the eviction * threshold is reached. In this task only one region is populated to trigger * the eviction of both PRs. */ public synchronized static void HydraTask_putExtraKeysWithSleep() { hydra.MasterController.sleepForMs(20000); testInstance.populateSpecificBucketofRegionWithSleep(regionB, regionB .getPartitionAttributes().getTotalNumBuckets() - 1, extraKeysToBePopulatedInRegionBLastBucket); }
/** * Resets the partition description based on partition attributes, to pick up * product defaults and side-effects. */ private static void resetPartitionDescription(PartitionDescription pd, PartitionAttributes pa) { if (pd.getLocalMaxMemory() != null) { pd.setLocalMaxMemory(new Integer(pa.getLocalMaxMemory())); } // else deferred pd.setRecoveryDelay(new Long(pa.getRecoveryDelay())); pd.setRedundantCopies(new Integer(pa.getRedundantCopies())); pd.setStartupRecoveryDelay(new Long(pa.getStartupRecoveryDelay())); pd.setTotalMaxMemory(new Long(pa.getTotalMaxMemory())); pd.setTotalNumBuckets(new Integer(pa.getTotalNumBuckets())); }
public boolean isRedundancyImpaired() { int numBuckets = this.prRegion.getPartitionAttributes().getTotalNumBuckets(); int targetRedundancy = this.prRegion.getPartitionAttributes().getRedundantCopies(); for (int i =0; i < numBuckets; i++) { int redundancy = this.prRegion.getRegionAdvisor().getBucketRedundancy(i); if (redundancy < targetRedundancy && redundancy != -1 || redundancy > targetRedundancy) { return true; } } return false; }
public boolean isRedundancyImpaired() { int numBuckets = this.prRegion.getPartitionAttributes().getTotalNumBuckets(); int targetRedundancy = this.prRegion.getPartitionAttributes().getRedundantCopies(); for (int i =0; i < numBuckets; i++) { int redundancy = this.prRegion.getRegionAdvisor().getBucketRedundancy(i); if (redundancy < targetRedundancy && redundancy != -1 || redundancy > targetRedundancy) { return true; } } return false; }
protected void populateSpecificBucketofRegionWithSleep( PartitionedRegion aRegion, int bucketId, int numEntries) { hydra.Log.getLogWriter().info( "Populating the bucketId " + bucketId + " with " + numEntries + "entries"); int entryKey = bucketId; // First entry will be 0 for bucket id 0, 1 for // bucket id 1 and 112 for bucketid 112. for (int numEntriesPerBucket = 0; numEntriesPerBucket < numEntries; numEntriesPerBucket++) { hydra.MasterController.sleepForMs(500); regionB.put(entryKey, new byte[ENTRY_SIZE_IN_BYTES]); entryKey = entryKey + regionB.getPartitionAttributes().getTotalNumBuckets(); } }
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; } } });
private void initRegion() { PartitionedRegion pr = (PartitionedRegion)getCommandRegion().getSubregion("pr"); if (pr == null) { return; } int totalBuckets = pr.getAttributes().getPartitionAttributes().getTotalNumBuckets(); for (int i = 0; i < totalBuckets; i++) { pr.put(i, i); pr.remove(i); } }
static void addBucketIdForMember(HashMapOrSet membersToBucketIds, DistributedMember member, int bucketId, PartitionedRegion region) { if (member != null) { if (membersToBucketIds.hasValues) { BitSetSet bucketSet = (BitSetSet)membersToBucketIds.get(member); if (bucketSet == null) { bucketSet = new BitSetSet(region.getPartitionAttributes() .getTotalNumBuckets()); membersToBucketIds.put(member, bucketSet); } bucketSet.addInt(bucketId); } else { membersToBucketIds.put(member, null); } } }
static void addBucketIdForMember(HashMapOrSet membersToBucketIds, DistributedMember member, int bucketId, PartitionedRegion region) { if (member != null) { if (membersToBucketIds.hasValues) { BitSetSet bucketSet = (BitSetSet)membersToBucketIds.get(member); if (bucketSet == null) { bucketSet = new BitSetSet(region.getPartitionAttributes() .getTotalNumBuckets()); membersToBucketIds.put(member, bucketSet); } bucketSet.addInt(bucketId); } else { membersToBucketIds.put(member, null); } } }
static void addBucketIdForMember(HashMapOrSet membersToBucketIds, DistributedMember member, int bucketId, PartitionedRegion region) { if (member != null) { if (membersToBucketIds.hasValues) { BitSetSet bucketSet = (BitSetSet)membersToBucketIds.get(member); if (bucketSet == null) { bucketSet = new BitSetSet(region.getPartitionAttributes() .getTotalNumBuckets()); membersToBucketIds.put(member, bucketSet); } bucketSet.addInt(bucketId); } else { membersToBucketIds.put(member, null); } } }
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 final void setTableDetails(final TableDescriptor td, final GemFireContainer container) { this.schemaName = td.getSchemaName(); this.tableName = td.getName(); if (container != null) { this.gfContainer = container; } else { this.gfContainer = (GemFireContainer)Misc.getRegionForTableByPath( Misc.getFullTableName(td, null), true).getUserAttribute(); } this.numBuckets = this.gfContainer.getRegionAttributes() .getPartitionAttributes().getTotalNumBuckets(); }
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; }
@SuppressWarnings("unchecked") public void setAll(@SuppressWarnings("rawtypes") PartitionAttributes pa) { setRedundantCopies(pa.getRedundantCopies()); setLocalProperties(pa.getLocalProperties()); setGlobalProperties(pa.getGlobalProperties()); setLocalMaxMemory(pa.getLocalMaxMemory()); setTotalMaxMemory(pa.getTotalMaxMemory()); setTotalNumBuckets(pa.getTotalNumBuckets()); setPartitionResolver(pa.getPartitionResolver()); setColocatedWith(pa.getColocatedWith()); setRecoveryDelay(pa.getRecoveryDelay()); setStartupRecoveryDelay(pa.getStartupRecoveryDelay()); setEnableOffHeapMemory(((PartitionAttributesImpl) pa).getEnableOffHeapMemory()); addFixedPartitionAttributes(pa.getFixedPartitionAttributes()); }
@SuppressWarnings("unchecked") public void setAll(@SuppressWarnings("rawtypes") PartitionAttributes pa) { setRedundantCopies(pa.getRedundantCopies()); setLocalProperties(pa.getLocalProperties()); setGlobalProperties(pa.getGlobalProperties()); setLocalMaxMemory(pa.getLocalMaxMemory()); setTotalMaxMemory(pa.getTotalMaxMemory()); setTotalNumBuckets(pa.getTotalNumBuckets()); setPartitionResolver(pa.getPartitionResolver()); setColocatedWith(pa.getColocatedWith()); setRecoveryDelay(pa.getRecoveryDelay()); setStartupRecoveryDelay(pa.getStartupRecoveryDelay()); setOffHeap(((PartitionAttributesImpl) pa).getOffHeap()); addFixedPartitionAttributes(pa.getFixedPartitionAttributes()); }