/** * Increments the count of buckets that do not meet redundancy */ synchronized void incrementLowRedundancyBucketCount() { if (lowRedundancyBuckets == totalBuckets) { return; } lowRedundancyBuckets++; stats.incLowRedundancyBucketCount(1); }
/** * Decrements the count of buckets that no longer have any copies remaining */ synchronized void decrementNoCopiesBucketCount() { if (noCopiesBuckets == 0) { return; } noCopiesBuckets--; stats.incNoCopiesBucketCount(-1); // if the last bucket with no copies has gained a copy, the bucket with the lowest // number of copies (that bucket) has one copy if (noCopiesBuckets == 0) { lowestBucketCopies = 1; } }
public void endContainsKey(long start) { endContainsKey(start, 1); }
this.prStats = new PartitionedRegionStats(cache.getDistributedSystem(), getFullPath()); this.regionIdentifier = getFullPath().replace('/', '#'); PartitionedRegionHelper.DEFAULT_TOTAL_WAIT_RETRY_ITERATION); this.totalNumberOfBuckets = this.partitionAttributes.getTotalNumBuckets(); this.prStats.incTotalNumBuckets(this.totalNumberOfBuckets); this.redundancyTracker = new PartitionedRegionRedundancyTracker(this.totalNumberOfBuckets, this.redundantCopies, this.prStats, getFullPath()); this.prStats.setConfiguredRedundantCopies( regionAttributes.getPartitionAttributes().getRedundantCopies()); this.prStats.setLocalMaxMemory( regionAttributes.getPartitionAttributes().getLocalMaxMemory() * 1024L * 1024);
int lowRedundancyBucketCount = prStats.getLowRedundancyBucketCount(); int configuredRedundantCopies = pr.getRedundantCopies(); int actualRedundantCopies = prStats.getActualRedundantCopies();
Object expectedOldValue, boolean requireOldValue, long lastModified, boolean overwriteDestroyed) throws TimeoutException, CacheWriterException { final long startTime = PartitionedRegionStats.startTime(); boolean result = false; final DistributedPutAllOperation putAllOp_save = event.setPutAllOperation(null); this.prStats.endCreate(startTime); } else { this.prStats.endPut(startTime);
/** * Returns whether there is a valid (non-null) value present for the specified key, locally or * remotely. This method is equivalent to: * * <pre> * Entry e = getEntry(key); * return e != null && e.getValue() != null; * </pre> * * This method does not consult localCache, even if enabled. * * @param key the key to check for a valid value * @return true if there is an entry in this region for the specified key and it has a valid value * OVERRIDES */ @Override public boolean containsValueForKey(Object key) { // checkClosed(); checkReadiness(); validateKey(key); final long startTime = PartitionedRegionStats.startTime(); boolean containsValueForKey = false; try { containsValueForKey = getDataView().containsValueForKey(getKeyInfo(key), this); } finally { this.prStats.endContainsValueForKey(startTime); } return containsValueForKey; }
@Override protected boolean nonTXContainsKey(KeyInfo keyInfo) { final long startTime = PartitionedRegionStats.startTime(); boolean contains = false; try { int bucketId = keyInfo.getBucketId(); if (bucketId == KeyInfo.UNKNOWN_BUCKET) { bucketId = PartitionedRegionHelper.getHashKey(this, Operation.CONTAINS_KEY, keyInfo.getKey(), keyInfo.getValue(), keyInfo.getCallbackArg()); keyInfo.setBucketId(bucketId); } Integer bucketIdInt = bucketId; InternalDistributedMember targetNode = getOrCreateNodeForBucketRead(bucketId); // targetNode null means that this key is not in the system. if (targetNode != null) { contains = containsKeyInBucket(targetNode, bucketIdInt, keyInfo.getKey(), false); } } finally { this.prStats.endContainsKey(startTime); } return contains; }
@Test public void willNotSetActualRedundantCopiesStatBelowZero() { redundancyTracker.setActualRedundancy(-1); assertEquals(0, stats.getActualRedundantCopies()); } }
if (isBucket) { BucketRegion br = (BucketRegion) rgn; br.getPartitionedRegion().getPrStats().startApplyReplication(); if (isBucket) { BucketRegion br = (BucketRegion) rgn; br.getPartitionedRegion().getPrStats().endApplyReplication(startPut); if (isBucket) { BucketRegion br = (BucketRegion) rgn; br.getPartitionedRegion().getPrStats().startApplyReplication(); if (isBucket) { BucketRegion br = (BucketRegion) rgn; br.getPartitionedRegion().getPrStats().endApplyReplication(startPut);
long startTime = this.partitionedRegion.getPrStats().startBucketCreate(isRebalance); boolean createdBucket = false; PartitionedRegionObserver observer = PartitionedRegionObserverHolder.getInstance(); this.partitionedRegion.getPrStats().endBucketCreate(startTime, createdBucket, isRebalance);
getPrStats().close(); this.cache.getInternalResourceManager(false).removeResourceListener(this); this.locallyDestroyingThread = null;
public void endCreate(long start) { endCreate(start, 1); }
public void endContainsValueForKey(long start) { endContainsValueForKey(start, 1); }
getPrStats().close(); if (getDiskStore() != null && getDiskStore().getOwnedByRegion()) { getDiskStore().close();
/** * Increments the count of buckets that no longer have any copies remaining */ synchronized void incrementNoCopiesBucketCount() { if (noCopiesBuckets == totalBuckets) { return; } noCopiesBuckets++; stats.incNoCopiesBucketCount(1); if (noCopiesBuckets == 1) { logger.warn("All in memory copies of some data have been lost for " + regionPath); } }
/** * Decrements the count of buckets that do not meet redundancy */ synchronized void decrementLowRedundancyBucketCount() { if (lowRedundancyBuckets == 0) { return; } lowRedundancyBuckets--; stats.incLowRedundancyBucketCount(-1); if (lowRedundancyBuckets == 0) { lowestBucketCopies = targetRedundancy + 1; logger.info("Configured redundancy of " + (targetRedundancy + 1) + " copies has been restored to " + regionPath); } }
getPrStats().close();
@Test public void incrementsAndDecrementsNoCopiesBucketCount() { redundancyTracker.incrementNoCopiesBucketCount(); verify(stats, times(1)).incNoCopiesBucketCount(1); redundancyTracker.decrementNoCopiesBucketCount(); verify(stats, times(1)).incNoCopiesBucketCount(-1); }
@Test public void incrementsAndDecrementsLowRedundancyBucketCount() { redundancyTracker.incrementLowRedundancyBucketCount(); verify(stats, times(1)).incLowRedundancyBucketCount(1); redundancyTracker.decrementLowRedundancyBucketCount(); verify(stats, times(1)).incLowRedundancyBucketCount(-1); }