@Override public long getEntrySize() { if (parRegion.isDataStore()) { return getPrStatistic(StatsKey.DATA_STORE_BYTES_IN_USE).longValue(); } else { return ManagementConstants.ZERO; } }
@Override protected void enableConcurrencyChecks() { if (!allowConcurrencyChecksOverride()) { return; } this.concurrencyChecksEnabled = true; assert !isDataStore(); }
@Override protected void enableConcurrencyChecks() { if(supportsConcurrencyChecks()) { this.concurrencyChecksEnabled = true; assert !isDataStore(); } }
@Override public long getEntrySize() { if (parRegion.isDataStore()) { return getPrStatistic(StatsKey.DATA_STORE_BYTES_IN_USE).longValue(); } else { return ManagementConstants.ZERO; } }
private void computeEntryCount() { if (parRegion.isDataStore()) { //if not a DataStore do nothing and keep the entryCount as 0; int numLocalEntries = 0; Map<Integer, SizeEntry> localPrimaryBucketRegions = parRegion.getDataStore() .getSizeEstimateForLocalPrimaryBuckets(); if (localPrimaryBucketRegions != null && localPrimaryBucketRegions.size() > 0) { for (Map.Entry<Integer, SizeEntry> me : localPrimaryBucketRegions.entrySet()) { numLocalEntries += me.getValue().getSize(); } } this.estimatedEntryCount = numLocalEntries; } }
private void computeEntryCount() { if (parRegion.isDataStore()) { //if not a DataStore do nothing and keep the entryCount as 0; int numLocalEntries = 0; Map<Integer, SizeEntry> localPrimaryBucketRegions = parRegion.getDataStore() .getSizeEstimateForLocalPrimaryBuckets(); if (localPrimaryBucketRegions != null && localPrimaryBucketRegions.size() > 0) { for (Map.Entry<Integer, SizeEntry> me : localPrimaryBucketRegions.entrySet()) { numLocalEntries += me.getValue().getSize(); } } this.estimatedEntryCount = numLocalEntries; } }
@Override public long getRowsInReservoir() { // TODO: this needs to be made efficient and PRStats must be updated during // creation rather than iterate in every call if (parRegion.isDataStore()) { int numLocalEntries = 0; Iterator itr = parRegion.localEntriesIterator((InternalRegionFunctionContext)null, true, false, true, null); while (itr.hasNext()) { RegionEntry re = (RegionEntry)itr.next(); Sizeable value = (Sizeable)re._getValue(); long valSize = value.getSizeInBytes(); if (valSize > minimumReservoirEntrySize) { numLocalEntries += (valSize - minimumReservoirEntrySize) / Sizeable.PER_OBJECT_OVERHEAD; } } return numLocalEntries; } else { return ManagementConstants.ZERO; } } }
private byte hasRemoteFPAttrs() { List<FixedPartitionAttributesImpl> fpaList = this.getRegionAdvisor() .adviseAllFixedPartitionAttributes(); Set<InternalDistributedMember> remoteDataStores = this.getRegionAdvisor() .adviseDataStore(); if (!fpaList.isEmpty() || (this.fixedPAttrs != null && !this.fixedPAttrs.isEmpty()) ) { return 1; } if (isDataStore() || !remoteDataStores.isEmpty()) { return 2; } // This is an accessor and we need to wait for a datastore to see if there //are any fixed PRs. return 0; }
private byte hasRemoteFPAttrs() { List<FixedPartitionAttributesImpl> fpaList = this.getRegionAdvisor() .adviseAllFixedPartitionAttributes(); Set<InternalDistributedMember> remoteDataStores = this.getRegionAdvisor() .adviseDataStore(); if (!fpaList.isEmpty() || (this.fixedPAttrs != null && !this.fixedPAttrs.isEmpty()) ) { return 1; } if (isDataStore() || !remoteDataStores.isEmpty()) { return 2; } // This is an accessor and we need to wait for a datastore to see if there //are any fixed PRs. return 0; }
public ConcurrentHashMap<Integer, Set<ServerBucketProfile>> getAllClientBucketProfilesTest() { ConcurrentHashMap<Integer, Set<ServerBucketProfile>> map = new ConcurrentHashMap<Integer, Set<ServerBucketProfile>>(); Map<Integer, List<BucketServerLocation66>> testMap = this.getAllClientBucketProfiles(); for (Integer bucketId : testMap.keySet()) { Set<ServerBucketProfile> parr = this.clientBucketProfilesMap.get(bucketId); map.put(bucketId, parr); } if (getPartitionedRegion().isDataStore()) { for (Integer bucketId : getPartitionedRegion().getDataStore().getAllLocalBucketIds()) { BucketProfile profile = getBucketAdvisor(bucketId).getLocalProfile(); if ((profile instanceof ServerBucketProfile) && profile.isHosting) { map.get(bucketId).add((ServerBucketProfile)profile); } } } if (logger.isDebugEnabled()) { logger.debug("This maps is sksk {} and size is {}", map, map.keySet().size()); } return map; }
public int entryCount(boolean localOnly) { if (localOnly) { if (this.isDataStore()) { return entryCount(this.dataStore.getAllLocalBucketIds()); } else { return 0; } } else { return entryCount(null); } }
/** * Test Method: Get all {@link InternalDistributedMember}s known by this * instance of the PartitionedRegion. Note: A member is recognized as such * when it partiticpates as a "data store". * * @return a <code>HashSet</code> of {@link InternalDistributedMember}s or * an empty <code>HashSet</code> */ public Set<InternalDistributedMember> getAllNodes() { Set<InternalDistributedMember> result = getRegionAdvisor().adviseDataStore(true); if(this.isDataStore()) { result.add(getDistributionManager().getId()); } return result; }
/** * Test Method: Get all {@link InternalDistributedMember}s known by this * instance of the PartitionedRegion. Note: A member is recognized as such * when it partiticpates as a "data store". * * @return a <code>HashSet</code> of {@link InternalDistributedMember}s or * an empty <code>HashSet</code> */ public Set<InternalDistributedMember> getAllNodes() { Set<InternalDistributedMember> result = getRegionAdvisor().adviseDataStore(true); if(this.isDataStore()) { result.add(getDistributionManager().getId()); } return result; }
@Override final synchronized public boolean putProfile(Profile p) { assert p instanceof CacheProfile; CacheProfile profile = (CacheProfile)p; PartitionedRegion pr = getPartitionedRegion(); if (profile.hasCacheLoader) { pr.setHaveCacheLoader(); } // don't keep FilterProfiles around in accessors. They're needed only for // routing messages in data stors if (profile.filterProfile != null) { if (!pr.isDataStore()) { profile.filterProfile = null; } } return super.putProfile(profile); }
public ConcurrentHashMap<Integer, Set<ServerBucketProfile>> getAllClientBucketProfilesTest() { ConcurrentHashMap<Integer, Set<ServerBucketProfile>> map = new ConcurrentHashMap<Integer, Set<ServerBucketProfile>>(); Map<Integer, List<BucketServerLocation66>> testMap = this.getAllClientBucketProfiles(); for (Integer bucketId : testMap.keySet()) { Set<ServerBucketProfile> parr = this.clientBucketProfilesMap.get(bucketId); map.put(bucketId, parr); } if (getPartitionedRegion().isDataStore()) { for (Integer bucketId : getPartitionedRegion().getDataStore().getAllLocalBucketIds()) { BucketProfile profile = getBucketAdvisor(bucketId).getLocalProfile(); if ((profile instanceof ServerBucketProfile) && profile.isHosting) { map.get(bucketId).add((ServerBucketProfile)profile); } } } if (getLogWriter().fineEnabled()) { getLogWriter().fine("This maps is sksk " + map + " and size is " + map.keySet().size()); } return map; }
@Override public long getEntryCount() { if (parRegion.isDataStore()) { int numLocalEntries = 0; Set<BucketRegion> localPrimaryBucketRegions = parRegion.getDataStore().getAllLocalPrimaryBucketRegions(); if (localPrimaryBucketRegions != null && localPrimaryBucketRegions.size() > 0) { for (BucketRegion br : localPrimaryBucketRegions) { // TODO soplog, fix this for griddb regions numLocalEntries += br.getRegionMap().sizeInVM() - br.getTombstoneCount(); } } return numLocalEntries; } else { return ManagementConstants.ZERO; } }
private static InternalDistributedMember dataStoreCheck( final DistributedMember target, final PartitionedRegion pr) { final InternalDistributedMember idmTarget = (InternalDistributedMember)target; final boolean localIsDatastore = pr.isDataStore() && pr.getCache().getDistributedSystem().getDistributedMember().equals( target); if (!(localIsDatastore || pr.getRegionAdvisor().adviseDataStore().contains( idmTarget))) { throw new IllegalArgumentException( LocalizedStrings.PartitionManager_PROVIDED_MEMBER_0_NO_PR_OR_NO_DATASTORE .toLocalizedString(target)); } return idmTarget; }
@Override public long getEntryCount() { if (parRegion.isDataStore()) { int numLocalEntries = 0; Set<BucketRegion> localPrimaryBucketRegions = parRegion.getDataStore().getAllLocalPrimaryBucketRegions(); if (localPrimaryBucketRegions != null && localPrimaryBucketRegions.size() > 0) { for (BucketRegion br : localPrimaryBucketRegions) { // TODO soplog, fix this for griddb regions numLocalEntries += br.getRegionMap().sizeInVM() - br.getTombstoneCount(); } } return numLocalEntries; } else { return ManagementConstants.ZERO; } }
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); } }
public Object call() throws Exception { AttributesFactory af = new AttributesFactory(); af.setDataPolicy(DataPolicy.HDFS_PARTITION); PartitionAttributesFactory paf = new PartitionAttributesFactory(); paf.setTotalNumBuckets(totalnumOfBuckets); paf.setRedundantCopies(1); //make this member an accessor. paf.setLocalMaxMemory(0); af.setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes(maximumEntries, EvictionAction.LOCAL_DESTROY)); af.setPartitionAttributes(paf.create()); Region r = createRootRegion(uniqueName, af.create()); assertTrue(!((PartitionedRegion) r).isDataStore()); return null; } };