public KeysSet() { super(PartitionedRegion.this, false, IteratorType.KEYS, getTXState(), false, false); this.bucketSet = null; }
/** * Fetch the keys for the given bucket identifier, if the bucket is local or * remote. This version of the method allows you to retrieve Tombstone entries * as well as undestroyed entries. * * @param bucketNum * @param allowTombstones whether to include destroyed entries in the result * @return A set of keys from bucketNum or {@link Collections#EMPTY_SET}if no * keys can be found. */ public Set getBucketKeys(int bucketNum, boolean allowTombstones) { return getBucketKeys(bucketNum, null, allowTombstones, getTXState()); }
@Override public int getRegionSize() { return entryCount(getTXState(), null); }
@Override public Set keySet(boolean allowTombstones) { checkReadiness(); return Collections.unmodifiableSet(new KeysSet(allowTombstones, getTXState())); }
public Set keysWithoutCreatesForTests() { checkReadiness(); Set<Integer> availableBuckets = new HashSet<Integer>(); for(int i =0; i < getTotalNumberOfBuckets(); i++) { if(distAdvisor.isStorageAssignedForBucket(i)) { availableBuckets.add(Integer.valueOf(i)); } } return Collections.unmodifiableSet(new KeysSet(availableBuckets, getTXState())); }
if (pr.getName().equals(CustomerPartitionedRegionName)) { Map map = ColocationHelper.getColocatedLocalDataSetsForBuckets( pr, new HashSet<Integer>(), pr.getTXState()); assertEquals(2, map.size()); rfContext.getResultSender().sendResult(map.size()); map = ColocationHelper.constructAndGetAllColocatedLocalDataSet( pr, new HashSet<Integer>(), pr.getTXState()); assertEquals(3, map.size()); rfContext.getResultSender().lastResult(map.size()); pr, new HashSet<Integer>(), pr.getTXState()); assertEquals(2, map.size()); rfContext.getResultSender().sendResult(map.size()); map = ColocationHelper.constructAndGetAllColocatedLocalDataSet( pr, new HashSet<Integer>(), pr.getTXState()); assertEquals(3, map.size()); rfContext.getResultSender().lastResult(map.size()); pr, new HashSet<Integer>(), pr.getTXState()); assertEquals(2, map.size()); rfContext.getResultSender().sendResult(map.size()); map = ColocationHelper.constructAndGetAllColocatedLocalDataSet( pr, new HashSet<Integer>(), pr.getTXState()); assertEquals(3, map.size()); rfContext.getResultSender().lastResult(map.size());
public Object call() throws Exception { try { final PartitionedRegion pr = (PartitionedRegion)getRootRegion(name); assertNotNull(pr); return pr.entryCount(pr.getTXState(), pr.getDataStore() .getAllLocalPrimaryBucketIds()); } finally { } } };
public static void flushLocalBuckets(String resolvedName, boolean forceFlush) { PartitionedRegion pr = (PartitionedRegion)Misc.getRegionForTable( resolvedName, false); PartitionedRegionDataStore ds; if (pr != null && (ds = pr.getDataStore()) != null) { TXStateInterface tx = pr.getTXState(); for (BucketRegion bucketRegion : ds.getAllLocalPrimaryBucketRegions()) { if (forceFlush || bucketRegion.checkForColumnBatchCreation(null)) { bucketRegion.createAndInsertColumnBatch(tx, forceFlush); } } } }
public int entryCount(boolean localOnly) { if (localOnly) { if (this.isDataStore()) { return entryCount(getTXState(), new THashSet(this.dataStore.getAllLocalBucketIds())); } else { return 0; } } else { return entryCount(null); } }
final PartitionedRegion pr = lds.getProxy(); ret = ColocationHelper.getColocatedLocalDataSetsForBuckets(pr, lds.getBucketSet(), pr.getTXState());
public static PartitionResponse send(Set recipients, PartitionedRegion r) { final TXStateInterface tx = r.getTXState(); PartitionResponse p = new PartitionResponse(r.getSystem(), recipients, tx); DumpAllPRConfigMessage m = new DumpAllPRConfigMessage(recipients, r.getPRId(), p, tx); /*Set failures = */r.getDistributionManager().putOutgoing(m); // if (failures != null && failures.size() > 0) { // throw new PartitionedRegionCommunicationException("Failed sending ", m); // } return p; }
public static DumpB2NResponse send(Set recipients, PartitionedRegion r, int bId, boolean justPrimaryInfo) { final TXStateInterface tx = r.getTXState(); DumpB2NResponse p = new DumpB2NResponse(r.getSystem(), recipients, tx); DumpB2NRegion m = new DumpB2NRegion(recipients, r.getPRId(), p, bId, justPrimaryInfo, tx); r.getDistributionManager().putOutgoing(m); return p; }
public static PartitionResponse send(Set recipients, PartitionedRegion r, final boolean validateOnly, final boolean onlyBuckets) { final TXStateInterface tx = r.getTXState(); PartitionResponse p = new PartitionResponse(r.getSystem(), recipients, tx); DumpBucketsMessage m = new DumpBucketsMessage(recipients, r.getPRId(), p, validateOnly, onlyBuckets, tx); /*Set failures =*/ r.getDistributionManager().putOutgoing(m); // if (failures != null && failures.size() > 0) { // throw new PartitionedRegionCommunicationException("Failed sending ", m); // } return p; }
buckets = Collections.emptySet(); return new LocalDataSet(pr, buckets, pr.getTXState()); } else if (r instanceof LocalDataSet) { return r;
buckets = Collections.emptySet(); return new LocalDataSet(pr, buckets, pr.getTXState()); } else if (r instanceof LocalDataSet) { return r;
.getAllLocalPrimaryBucketIds(), getTXState()); Iterator itr = vSet.iterator(); while (itr.hasNext()) {
return pr.entryCount(pr.getTXState(), allBuckets); return pr.entryCount(pr.getTXState(), bucketIds); return pr.entryCount(pr.getTXState(), pr.getDataStore() .getAllLocalPrimaryBucketIds());
TXStateProxy txState = getTXState(); boolean allowRetry; if (txState != null) {
public QRegion(Region region, boolean includeKeys, ExecutionContext context) { if (region == null) throw new IllegalArgumentException(LocalizedStrings.QRegion_REGION_CAN_NOT_BE_NULL.toLocalizedString()); Class constraint = region.getAttributes().getValueConstraint(); if (constraint == null) constraint = Object.class; ResultsCollectionWrapper res = null; if (context.getBucketList() != null && region instanceof PartitionedRegion) { final PartitionedRegion pr = (PartitionedRegion)region; LocalDataSet localData = new LocalDataSet(pr, new THashSet( context.getBucketList()), pr.getTXState()); this.region = localData; if (includeKeys) { res = new ResultsCollectionWrapper(TypeUtils.getObjectType(constraint), localData.localEntrySet()); } else { res = new ResultsCollectionWrapper(TypeUtils.getObjectType(constraint), localData.localValues()); } } else { this.region = region; if (includeKeys) { res = new ResultsCollectionWrapper(TypeUtils.getObjectType(constraint), region.entrySet()); } else { res = new ResultsCollectionWrapper(TypeUtils.getObjectType(constraint), region.values()); } } res.setModifiable(false); this.values = res; }
return null; } else { final TXStateInterface tx = getTXState(); final FetchEntriesResponse r; r = FetchEntriesMessage.send(nod,