geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhem...@apache.org
Subject [geode] 18/18: Clean up earlier changes
Date Mon, 22 Jul 2019 22:09:31 GMT
This is an automated email from the ASF dual-hosted git repository.

dhemery pushed a commit to branch GEODE-7001-region-entry-count
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 94a1d3d00994ca86b737f6af3bbfb17dfb2b4650
Author: Dale Emery <demery@pivotal.io>
AuthorDate: Mon Jul 22 14:16:13 2019 -0700

    Clean up earlier changes
    
    - Remove unnecessary use of SuppliableStatistics in test
    - Revert entryGaugeId back to entryCountId
    - Add @Override to ValidatingStatisticsType methods in
    StatisticsTypeImpl
    
    Co-Authored-By Michael Oleske <moleske@pivotal.io>
---
 .../internal/cache/PartitionedRegionStatsDUnitTest.java  |  2 +-
 .../org/apache/geode/internal/cache/CachePerfStats.java  |  6 +++---
 .../org/apache/geode/internal/cache/RegionPerfStats.java |  2 +-
 .../geode/internal/statistics/StatisticsTypeImpl.java    |  2 ++
 .../apache/geode/internal/cache/CachePerfStatsTest.java  | 10 +++++-----
 .../apache/geode/internal/cache/RegionPerfStatsTest.java | 16 ++++++++--------
 6 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionStatsDUnitTest.java
b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionStatsDUnitTest.java
index 2ac97cf..bf66968 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionStatsDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionStatsDUnitTest.java
@@ -264,7 +264,7 @@ public class PartitionedRegionStatsDUnitTest extends CacheTestCase {
     CachePerfStats cachePerfStats = region.getCachePerfStats();
 
     assertThat(stats.getDataStoreEntryCount()).isEqualTo(expectedCount);
-    long actualCount = cachePerfStats.stats.getLong(CachePerfStats.entryGaugeId);
+    long actualCount = cachePerfStats.stats.getLong(CachePerfStats.entryCountId);
     assertThat(actualCount).isEqualTo(expectedCount);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/CachePerfStats.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/CachePerfStats.java
index b597ec9..83a55ce 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/CachePerfStats.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/CachePerfStats.java
@@ -108,7 +108,7 @@ public class CachePerfStats {
   static final int reliableRegionsMissingFullAccessId;
   static final int reliableRegionsMissingLimitedAccessId;
   static final int reliableRegionsMissingNoAccessId;
-  static final int entryGaugeId;
+  static final int entryCountId;
   protected static final int eventsQueuedId;
   static final int retriesId;
 
@@ -573,7 +573,7 @@ public class CachePerfStats {
     reliableRegionsMissingFullAccessId = type.nameToId("reliableRegionsMissingFullAccess");
     reliableRegionsMissingLimitedAccessId = type.nameToId("reliableRegionsMissingLimitedAccess");
     reliableRegionsMissingNoAccessId = type.nameToId("reliableRegionsMissingNoAccess");
-    entryGaugeId = type.nameToId("entries");
+    entryCountId = type.nameToId("entries");
 
     eventsQueuedId = type.nameToId("eventsQueued");
 
@@ -1320,7 +1320,7 @@ public class CachePerfStats {
   }
 
   public void incEntryCount(int delta) {
-    stats.incLong(entryGaugeId, delta);
+    stats.incLong(entryCountId, delta);
   }
 
   public void incRetries() {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/RegionPerfStats.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/RegionPerfStats.java
index 2973ac3..1e6e66a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/RegionPerfStats.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/RegionPerfStats.java
@@ -50,7 +50,7 @@ class RegionPerfStats extends CachePerfStats {
         .tag("region.name", regionName)
         .baseUnit("entries")
         .register(meterRegistry);
-    stats.setLongSupplier(entryGaugeId, entryCount::get);
+    stats.setLongSupplier(entryCountId, entryCount::get);
   }
 
   private static LongSupplier createClock() {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/statistics/StatisticsTypeImpl.java
b/geode-core/src/main/java/org/apache/geode/internal/statistics/StatisticsTypeImpl.java
index 9af5258..7eb1e04 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/statistics/StatisticsTypeImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/statistics/StatisticsTypeImpl.java
@@ -221,10 +221,12 @@ public class StatisticsTypeImpl implements ValidatingStatisticsType
{
     return true;
   }
 
+  @Override
   public boolean isValidLongId(int id) {
     return id < longStatCount;
   }
 
+  @Override
   public boolean isValidDoubleId(int id) {
     return longStatCount <= id && id < longStatCount + doubleStatCount;
   }
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/CachePerfStatsTest.java
b/geode-core/src/test/java/org/apache/geode/internal/cache/CachePerfStatsTest.java
index 6a3de24..3ae5ee2 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/CachePerfStatsTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/CachePerfStatsTest.java
@@ -26,7 +26,7 @@ import static org.apache.geode.internal.cache.CachePerfStats.deltaUpdatesId;
 import static org.apache.geode.internal.cache.CachePerfStats.deltasPreparedId;
 import static org.apache.geode.internal.cache.CachePerfStats.deltasSentId;
 import static org.apache.geode.internal.cache.CachePerfStats.destroysId;
-import static org.apache.geode.internal.cache.CachePerfStats.entryGaugeId;
+import static org.apache.geode.internal.cache.CachePerfStats.entryCountId;
 import static org.apache.geode.internal.cache.CachePerfStats.evictorJobsCompletedId;
 import static org.apache.geode.internal.cache.CachePerfStats.evictorJobsStartedId;
 import static org.apache.geode.internal.cache.CachePerfStats.getInitialImagesCompletedId;
@@ -60,11 +60,11 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import org.apache.geode.Statistics;
 import org.apache.geode.StatisticsFactory;
 import org.apache.geode.StatisticsType;
 import org.apache.geode.internal.statistics.StatisticsManager;
 import org.apache.geode.internal.statistics.StripedStatisticsImpl;
-import org.apache.geode.internal.statistics.SuppliableStatistics;
 
 /**
  * Unit tests for {@link CachePerfStats}.
@@ -74,7 +74,7 @@ public class CachePerfStatsTest {
   private static final String TEXT_ID = "cachePerfStats";
   private static final long CLOCK_TIME = 10;
 
-  private SuppliableStatistics statistics;
+  private Statistics statistics;
   private CachePerfStats cachePerfStats;
 
   @Before
@@ -1130,13 +1130,13 @@ public class CachePerfStatsTest {
   public void incEntryCount_whenDeltaIsPositive_increasesTheEntryCountStat() {
     cachePerfStats.incEntryCount(2);
 
-    assertThat(statistics.getLong(entryGaugeId)).isEqualTo(2);
+    assertThat(statistics.getLong(entryCountId)).isEqualTo(2);
   }
 
   @Test
   public void incEntryCount_whenDeltaIsNegative_decreasesTheEntryCountStat() {
     cachePerfStats.incEntryCount(-2);
 
-    assertThat(statistics.getLong(entryGaugeId)).isEqualTo(-2);
+    assertThat(statistics.getLong(entryCountId)).isEqualTo(-2);
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/RegionPerfStatsTest.java
b/geode-core/src/test/java/org/apache/geode/internal/cache/RegionPerfStatsTest.java
index ed28ed7..0476798 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/RegionPerfStatsTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/RegionPerfStatsTest.java
@@ -91,13 +91,6 @@ public class RegionPerfStatsTest {
   }
 
   @Test
-  public void incEntryCount_incrementsCachePerfStatsEntryCount() {
-    regionPerfStats.incEntryCount(2);
-
-    verify(cachePerfStats).incEntryCount(2);
-  }
-
-  @Test
   public void constructor_createsEntriesGauge_taggedWithRegionName() {
     Gauge entriesGauge = meterRegistry
         .find("member.region.entries")
@@ -110,7 +103,7 @@ public class RegionPerfStatsTest {
   public void suppliesEntryCountStatWithAccumulatedEntryCount() {
     ArgumentCaptor<LongSupplier> supplierCaptor = ArgumentCaptor.forClass(LongSupplier.class);
 
-    verify(statistics).setLongSupplier(eq(RegionPerfStats.entryGaugeId), supplierCaptor.capture());
+    verify(statistics).setLongSupplier(eq(RegionPerfStats.entryCountId), supplierCaptor.capture());
 
     LongSupplier capturedSupplier = supplierCaptor.getValue();
     assertThat(capturedSupplier.getAsLong())
@@ -127,6 +120,13 @@ public class RegionPerfStatsTest {
   }
 
   @Test
+  public void incEntryCount_incrementsCachePerfStatsEntryCount() {
+    regionPerfStats.incEntryCount(2);
+
+    verify(cachePerfStats).incEntryCount(2);
+  }
+
+  @Test
   public void incEntryCount_updatesMeterForThisRegion() {
     regionPerfStats.incEntryCount(1);
     regionPerfStats.incEntryCount(3);


Mime
View raw message