@Override public void run() { putMsg.resetRecipients(); putMsg.setRecipient(msg.getSender()); putMsg.setSendDelta(false); if (logger.isDebugEnabled()) { logger.debug("Sending full object({}) to {}", putMsg, Arrays.toString(putMsg.getRecipients())); } dm.putOutgoing(putMsg); // Update stats try { PartitionedRegion.getPRFromId(putMsg.regionId).getCachePerfStats() .incDeltaFullValuesSent(); } catch (Exception e) { } }
final long start = getCachePerfStats().startCacheWriterCall(); getCachePerfStats().endCacheWriterCall(start);
/** * Creates PartitionedRegionDataStore for dataStorage of PR and starts a PartitionService to * handle remote operations on this DataStore from other participating nodes. * * @param pr PartitionedRegion associated with this DataStore. */ PartitionedRegionDataStore(final PartitionedRegion pr) { final int bucketCount = pr.getTotalNumberOfBuckets(); this.localBucket2RegionMap = new ConcurrentHashMap<Integer, BucketRegion>(bucketCount); this.partitionedRegion = pr; this.bucketCreationLock = new StoppableReentrantReadWriteLock(pr.getCancelCriterion()); if (pr.getAttributes().getCacheLoader() != null) { this.loader = pr.getAttributes().getCacheLoader(); if (logger.isDebugEnabled()) { logger.debug("Installing cache loader from partitioned region attributes: {}", loader); } } // this.maximumLocalBytes = (long) (pr.getLocalMaxMemory() * // PartitionedRegionHelper.BYTES_PER_MB // * this.partitionedRegion.rebalanceThreshold); this.maximumLocalBytes = (pr.getLocalMaxMemory() * PartitionedRegionHelper.BYTES_PER_MB); // this.bucketStats = new CachePerfStats(pr.getSystem(), "partition-" + pr.getName()); this.bucketStats = new RegionPerfStats(pr.getCache(), pr.getCachePerfStats(), "partition-" + pr.getName()); this.keysOfInterest = new ConcurrentHashMap(); }
/** * This invokes a cache writer before a destroy operation. Although it has the same method * signature as the method in LocalRegion, it is invoked in a different code path. LocalRegion * invokes this method via its "entries" member, while PartitionedRegion invokes this method in * its region operation methods and messages. */ @Override boolean cacheWriteBeforeRegionDestroy(RegionEventImpl event) throws CacheWriterException, TimeoutException { if (event.getOperation().isDistributed()) { serverRegionDestroy(event); CacheWriter localWriter = basicGetWriter(); Set netWriteRecipients = localWriter == null ? this.distAdvisor.adviseNetWrite() : null; if (localWriter == null && (netWriteRecipients == null || netWriteRecipients.isEmpty())) { return false; } final long start = getCachePerfStats().startCacheWriterCall(); try { SearchLoadAndWriteProcessor processor = SearchLoadAndWriteProcessor.getProcessor(); processor.initialize(this, "preDestroyRegion", null); processor.doNetWrite(event, netWriteRecipients, localWriter, SearchLoadAndWriteProcessor.BEFOREREGIONDESTROY); processor.release(); } finally { getCachePerfStats().endCacheWriterCall(start); } return true; } return false; }
if (isDebugEnabled) { logger.debug("PR Query retry: {} total: {}", retry, this.pr.getCachePerfStats().getPRQueryRetries()); this.pr.getCachePerfStats().incPRQueryRetries(); retry++;
@Before public void setup() throws Exception { localNode = new InternalDistributedMember("localhost", 8888); remoteNodeA = new InternalDistributedMember("localhost", 8889); remoteNodeB = new InternalDistributedMember("localhost", 8890); cache = Fakes.cache(); system = (InternalDistributedSystem) cache.getDistributedSystem(); allNodes.add(localNode); allNodes.add(remoteNodeA); allNodes.add(remoteNodeB); pr = mock(PartitionedRegion.class); dataStore = new ExtendedPartitionedRegionDataStore(); CompiledSelect select = mock(CompiledSelect.class); when(select.getType()).thenReturn(CompiledValue.COMPARISON); when(select.getElementTypeForOrderByQueries()).thenReturn(new ObjectTypeImpl(String.class)); query = mock(DefaultQuery.class); when(query.getSimpleSelect()).thenReturn(select); when(query.getLimit(any())).thenReturn(-1); when(pr.getCachePerfStats()).thenReturn(mock(CachePerfStats.class)); when(pr.getMyId()).thenReturn(localNode); when(pr.getDataStore()).thenReturn(dataStore); when(pr.getCache()).thenReturn(cache); }
final long start = getCachePerfStats().startCacheWriterCall(); try { event.setOldValueFromRegion(); processor.release(); } finally { getCachePerfStats().endCacheWriterCall(start);
SelectResults resultCount = new ResultsBag(getCachePerfStats()); resultCount.setElementType(new ObjectTypeImpl(Integer.class)); ((Bag) resultCount).addAndGetOccurence(results.size());
throw new IOException("Delta can not be extracted as region is locally destroyed"); if (region == null || region.getCachePerfStats() == null) { throw new IOException( "Delta can not be extracted as region can't be found or is in an invalid state"); region.getCachePerfStats().incDeltasSent(); } else { DistributedCacheOperation.writeValue(this.deserializationPolicy, this.valObj, getValBytes(),
/** * override the one in LocalRegion since we don't need to do getDeserialized. */ @Override public Object get(Object key, Object aCallbackArgument, boolean generateCallbacks, boolean disableCopyOnRead, boolean preferCD, ClientProxyMembershipID requestingClient, EntryEventImpl clientEvent, boolean returnTombstones) throws TimeoutException, CacheLoaderException { validateKey(key); checkReadiness(); checkForNoAccess(); discoverJTA(); CachePerfStats stats = getCachePerfStats(); long start = stats.startGet(); boolean miss = true; try { // if scope is local and there is no loader, then // don't go further to try and get value Object value = getDataView().findObject(getKeyInfo(key, aCallbackArgument), this, true/* isCreate */, generateCallbacks, null /* no local value */, disableCopyOnRead, preferCD, requestingClient, clientEvent, returnTombstones); if (value != null && !Token.isInvalid(value)) { miss = false; } return value; } finally { stats.endGet(start, miss); } }
((org.apache.geode.Delta) instance).toDelta(hdos); event.setDeltaBytes(hdos.toByteArray()); this.partitionedRegion.getCachePerfStats().endDeltaPrepared(start); } catch (RuntimeException re) { throw re;
} catch (InvalidDeltaException ide) { sendReply(getSender(), getProcessorId(), dm, new ReplyException(ide), r, startTime); r.getCachePerfStats().incDeltaFullValuesRequested(); return false;