public PartitionedRegionStats getPartitionedRegionStats() { return getPartitionedRegion().getPrStats(); }
long getStartPartitionMessageProcessingTime(PartitionedRegion pr) { return pr.getPrStats().startPartitionMessageProcessing(); }
@Override public void updateSizeOnCreate(Object key, int newSize) { this.partitionedRegion.getPrStats().incDataStoreEntryCount(1); updateBucket2Size(0, newSize, SizeOp.CREATE); }
@Override public void updateSizeOnRemove(Object key, int oldSize) { this.partitionedRegion.getPrStats().incDataStoreEntryCount(-1); updateBucket2Size(oldSize, 0, SizeOp.DESTROY); }
@Override protected boolean operateOnPartitionedRegion(ClusterDistributionManager dm, PartitionedRegion region, long startTime) throws ForceReattemptException { // this is executing in the WAITING_POOL_EXECUTOR try { region.getRedundancyProvider().endBucketCreationLocally(bucketId, newPrimary); } finally { region.getPrStats().endPartitionMessagesProcessing(startTime); } return false; }
@Override protected void sendReply(InternalDistributedMember member, int procId, DistributionManager dm, ReplyException ex, PartitionedRegion pr, long startTime) { if (pr != null && startTime > 0) { pr.getPrStats().endPartitionMessagesProcessing(startTime); } InvalidateReplyMessage.send(member, procId, getReplySender(dm), ex, this.versionTag); }
@Before public void setup() { initMocks(this); when(partitionedRegion.getDataStore()).thenReturn(partitionedRegionDataStore); when(partitionedRegion.getPrStats()).thenReturn(partitionedRegionStats); }
/** * Send a generic ReplyMessage. This is in a method so that subclasses can override the reply * message type * * @param pr the Partitioned Region for the message whose statistics are incremented * @param startTime the start time of the operation in nanoseconds * @see PutMessage#sendReply */ protected void sendReply(InternalDistributedMember member, int procId, DistributionManager dm, ReplyException ex, PartitionedRegion pr, long startTime) { if (pr != null && startTime > 0) { pr.getPrStats().endPartitionMessagesProcessing(startTime); } ReplyMessage.send(member, procId, ex, getReplySender(dm), pr != null && pr.isInternalRegion()); }
public static PartitionedRegion createMockQueueRegion(GemFireCacheImpl cache, String regionName) { // Mock queue region PartitionedRegion queueRegion = mock(PartitionedRegion.class); when(queueRegion.getFullPath()).thenReturn(regionName); when(queueRegion.getPrStats()).thenReturn(mock(PartitionedRegionStats.class)); when(queueRegion.getDataStore()).thenReturn(mock(PartitionedRegionDataStore.class)); when(queueRegion.getCache()).thenReturn(cache); EvictionAttributesImpl ea = (EvictionAttributesImpl) EvictionAttributes .createLRUMemoryAttributes(100, null, EvictionAction.OVERFLOW_TO_DISK); EvictionController eviction = AbstractEvictionController.create(ea, false, cache.getDistributedSystem(), "queueRegion"); when(queueRegion.getEvictionController()).thenReturn(eviction); return queueRegion; }
@Override protected void sendReply(InternalDistributedMember member, int procId, DistributionManager dm, ReplyException ex, PartitionedRegion pr, long startTime) { if (pr != null) { if (startTime > 0) { pr.getPrStats().endPartitionMessagesProcessing(startTime); } if (!pr.getConcurrencyChecksEnabled() && this.versions != null) { this.versions.clear(); } } RemoveAllReplyMessage.send(member, procId, getReplySender(dm), this.result, this.versions, ex); }
protected void sendReply(InternalDistributedMember member, int procId, DistributionManager dm, ReplyException ex, PartitionedRegion pr, long startTime, EntryEventImpl ev) { if (pr != null && startTime > 0) { pr.getPrStats().endPartitionMessagesProcessing(startTime); pr.getCancelCriterion().checkCancelInProgress(null); // bug 39014 - don't send a positive // response if we may have failed } PutReplyMessage.send(member, procId, getReplySender(dm), result, getOperation(), ex, this, ev); }
@Override protected boolean operateOnPartitionedRegion(ClusterDistributionManager dm, PartitionedRegion region, long startTime) throws ForceReattemptException { PartitionedRegionDataStore dataStore = region.getDataStore(); boolean moved = dataStore.moveBucket(this.bucketId, this.source, true); region.getPrStats().endPartitionMessagesProcessing(startTime); MoveBucketReplyMessage.send(getSender(), getProcessorId(), dm, null, moved); return false; }
@Override protected boolean operateOnPartitionedRegion(ClusterDistributionManager dm, PartitionedRegion region, long startTime) throws ForceReattemptException { PartitionedRegionDataStore dataStore = region.getDataStore(); boolean removed = dataStore.removeBucket(this.bucketId, this.forceRemovePrimary); region.getPrStats().endPartitionMessagesProcessing(startTime); RemoveBucketReplyMessage.send(getSender(), getProcessorId(), dm, null, removed); return false; }
@Override protected boolean operateOnPartitionedRegion(ClusterDistributionManager dm, PartitionedRegion region, long startTime) throws ForceReattemptException { BucketAdvisor bucketAdvisor = region.getRegionAdvisor().getBucketAdvisor(this.bucketId); bucketAdvisor.deposePrimary(); region.getPrStats().endPartitionMessagesProcessing(startTime); DeposePrimaryBucketReplyMessage.send(getSender(), getProcessorId(), dm, (ReplyException) null); return false; }
@Override protected boolean operateOnPartitionedRegion(ClusterDistributionManager dm, PartitionedRegion region, long startTime) throws ForceReattemptException { // this is executing in the WAITING_POOL_EXECUTOR byte responseCode = BecomePrimaryBucketReplyMessage.NOT_SECONDARY; BucketAdvisor bucketAdvisor = region.getRegionAdvisor().getBucketAdvisor(this.bucketId); if (bucketAdvisor.isHosting()) { if (bucketAdvisor.becomePrimary(this.isRebalance)) { // sends a request/reply message responseCode = BecomePrimaryBucketReplyMessage.OK; } } region.getPrStats().endPartitionMessagesProcessing(startTime); BecomePrimaryBucketReplyMessage.send(getSender(), getProcessorId(), dm, null, responseCode); return false; }
public void addRegion(Region region) { if (region.getAttributes().getPartitionAttributes() != null) { addPartionRegionStats(((PartitionedRegion) region).getPrStats()); } InternalRegion internalRegion = (InternalRegion) region; addLRUStats(internalRegion.getEvictionStatistics()); DiskRegion dr = internalRegion.getDiskRegion(); if (dr != null) { for (DirectoryHolder dh : dr.getDirectories()) { addDirectoryStats(dh.getDiskDirectoryStats()); } } }
public void removeRegion(Region region) { if (region.getAttributes().getPartitionAttributes() != null) { removePartionRegionStats(((PartitionedRegion) region).getPrStats()); } LocalRegion l = (LocalRegion) region; removeLRUStats(l.getEvictionStatistics()); DiskRegion dr = l.getDiskRegion(); if (dr != null) { for (DirectoryHolder dh : dr.getDirectories()) { removeDirectoryStats(dh.getDiskDirectoryStats()); } } }
@Override protected void sendReply(InternalDistributedMember member, int procId, DistributionManager dm, ReplyException ex, PartitionedRegion pr, long startTime) { if (pr != null && startTime > 0) { pr.getPrStats().endPartitionMessagesProcessing(startTime); } if (ex == null) { DestroyReplyMessage.send(getSender(), getReplySender(dm), this.processorId, this.versionTag, pr != null && pr.isInternalRegion()); } else { ReplyMessage.send(getSender(), this.processorId, ex, getReplySender(dm), pr != null && pr.isInternalRegion()); } }
protected PartitionedRegionBridge(Region<K, V> region) { super(region); this.parRegion = (PartitionedRegion) region; this.prStats = parRegion.getPrStats(); PartitionAttributes<K, V> partAttrs = parRegion.getPartitionAttributes(); this.parRegionMonitor = new MBeanStatsMonitor(PAR_REGION_MONITOR); this.configurePartitionRegionMetrics(); this.configuredRedundancy = partAttrs.getRedundantCopies(); this.partitionAttributesData = RegionMBeanCompositeDataFactory.getPartitionAttributesData(partAttrs); if (partAttrs.getFixedPartitionAttributes() != null) { this.fixedPartitionAttributesTable = RegionMBeanCompositeDataFactory.getFixedPartitionAttributesData(partAttrs); } parRegionMonitor.addStatisticsToMonitor(prStats.getStats()); }
protected void writeReplyWithRefreshMetadata(Message origMsg, ServerConnection serverConnection, PartitionedRegion pr, byte nwHop) throws IOException { Message replyMsg = serverConnection.getReplyMessage(); serverConnection.getCache().getCancelCriterion().checkCancelInProgress(null); replyMsg.setMessageType(MessageType.REPLY); replyMsg.setNumberOfParts(1); replyMsg.setTransactionId(origMsg.getTransactionId()); replyMsg.addBytesPart(new byte[] {pr.getMetadataVersion(), nwHop}); replyMsg.send(serverConnection); pr.getPrStats().incPRMetaDataSentCount(); if (logger.isTraceEnabled()) { logger.trace("{}: rpl with REFRESH_METADATA tx: {}", serverConnection.getName(), origMsg.getTransactionId()); } }