You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bo...@apache.org on 2021/01/13 00:47:56 UTC
[geode] 01/01: GEODE-8827: Modified LocalRegion.initializeStats to
increment bytesOnlyOnDisk
This is an automated email from the ASF dual-hosted git repository.
boglesby pushed a commit to branch feature/GEODE-8827
in repository https://gitbox.apache.org/repos/asf/geode.git
commit 0c7d471c4f2df6c4e0b43998226a9ab2950c8d7d
Author: Barry Oglesby <bo...@pivotal.io>
AuthorDate: Tue Jan 12 16:44:47 2021 -0800
GEODE-8827: Modified LocalRegion.initializeStats to increment bytesOnlyOnDisk
---
.../apache/geode/internal/cache/LocalRegion.java | 1 +
.../geode/internal/cache/LocalRegionTest.java | 25 ++++++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
index 61328f3..96b2738 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java
@@ -10219,6 +10219,7 @@ public class LocalRegion extends AbstractRegion implements LoaderHelperFactory,
long numOverflowBytesOnDisk) {
getDiskRegion().getStats().incNumEntriesInVM(numEntriesInVM);
getDiskRegion().getStats().incNumOverflowOnDisk(numOverflowOnDisk);
+ getDiskRegion().getStats().incNumOverflowBytesOnDisk(numOverflowBytesOnDisk);
}
/**
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/LocalRegionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/LocalRegionTest.java
index dd9cce1..44599be 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/LocalRegionTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/LocalRegionTest.java
@@ -277,4 +277,29 @@ public class LocalRegionTest {
assertThat(region.isGenerateLocalFilterRoutingNeeded(event)).isFalse();
}
+
+ @Test
+ public void initializeStatsInvokesDiskRegionStatsMethods() {
+ LocalRegion region =
+ spy(new LocalRegion("region", regionAttributes, null, cache, internalRegionArguments,
+ internalDataView, regionMapConstructor, serverRegionProxyConstructor, entryEventFactory,
+ poolFinder, regionPerfStatsFactory, disabledClock()));
+
+ // Mock DiskRegion and DiskRegionStats
+ DiskRegion dr = mock(DiskRegion.class);
+ when(region.getDiskRegion()).thenReturn(dr);
+ DiskRegionStats drs = mock(DiskRegionStats.class);
+ when(dr.getStats()).thenReturn(drs);
+
+ // Invoke initializeStats
+ int numEntriesInVM = 100;
+ long numOverflowOnDisk = 200l;
+ long numOverflowBytesOnDisk = 300l;
+ region.initializeStats(numEntriesInVM, numOverflowOnDisk, numOverflowBytesOnDisk);
+
+ // Verify the DiskRegionStats methods were invoked
+ verify(drs).incNumEntriesInVM(numEntriesInVM);
+ verify(drs).incNumOverflowOnDisk(numOverflowOnDisk);
+ verify(drs).incNumOverflowBytesOnDisk(numOverflowBytesOnDisk);
+ }
}