hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject hbase git commit: HBASE-12961 Fix negative values in read and write region server metrics.
Date Wed, 04 Feb 2015 18:35:06 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 d33bc0c8c -> de92ccbb2


HBASE-12961 Fix negative values in read and write region server metrics.


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/de92ccbb
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/de92ccbb
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/de92ccbb

Branch: refs/heads/branch-1
Commit: de92ccbb276808d0fe8598b62d77c906b054c1fc
Parents: d33bc0c
Author: Victoria Dudin <vdudin@vdudin-mbp.local>
Authored: Tue Feb 3 09:47:46 2015 -0800
Committer: Elliott Clark <eclark@apache.org>
Committed: Wed Feb 4 10:32:17 2015 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/hadoop/hbase/ServerLoad.java |  8 ++++----
 .../java/org/apache/hadoop/hbase/TestServerLoad.java  | 14 +++++++++++---
 2 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/de92ccbb/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerLoad.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerLoad.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerLoad.java
index 06a61c0..c535cec 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerLoad.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerLoad.java
@@ -45,8 +45,8 @@ public class ServerLoad {
   private int storefileSizeMB = 0;
   private int memstoreSizeMB = 0;
   private int storefileIndexSizeMB = 0;
-  private int readRequestsCount = 0;
-  private int writeRequestsCount = 0;
+  private long readRequestsCount = 0;
+  private long writeRequestsCount = 0;
   private int rootIndexSizeKB = 0;
   private int totalStaticIndexSizeKB = 0;
   private int totalStaticBloomSizeKB = 0;
@@ -138,11 +138,11 @@ public class ServerLoad {
     return storefileIndexSizeMB;
   }
 
-  public int getReadRequestsCount() {
+  public long getReadRequestsCount() {
     return readRequestsCount;
   }
 
-  public int getWriteRequestsCount() {
+  public long getWriteRequestsCount() {
     return writeRequestsCount;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/de92ccbb/hbase-server/src/test/java/org/apache/hadoop/hbase/TestServerLoad.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestServerLoad.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestServerLoad.java
index 4dcfe24..a2af693 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestServerLoad.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestServerLoad.java
@@ -42,7 +42,7 @@ public class TestServerLoad {
     assertEquals(504, sl.getRootIndexSizeKB());
     assertEquals(820, sl.getStorefileSizeInMB());
     assertEquals(82, sl.getStorefileIndexSizeInMB());
-    assertEquals(0, sl.getReadRequestsCount());
+    assertEquals(((long)Integer.MAX_VALUE)*2, sl.getReadRequestsCount());
     
   }
  
@@ -58,6 +58,14 @@ public class TestServerLoad {
     assertTrue(slToString.contains("coprocessors=[]"));
   }
 
+  @Test
+  public void testRegionLoadWrapAroundAggregation() {
+	  ServerLoad sl = new ServerLoad(createServerLoadProto());
+	  long totalCount = ((long)Integer.MAX_VALUE)*2;
+	  assertEquals(totalCount, sl.getReadRequestsCount());
+	  assertEquals(totalCount, sl.getWriteRequestsCount());
+  }
+  
   private ClusterStatusProtos.ServerLoad createServerLoadProto() {
     HBaseProtos.RegionSpecifier rSpecOne =
         HBaseProtos.RegionSpecifier.newBuilder()
@@ -71,11 +79,11 @@ public class TestServerLoad {
     ClusterStatusProtos.RegionLoad rlOne =
         ClusterStatusProtos.RegionLoad.newBuilder().setRegionSpecifier(rSpecOne).setStores(10)
             .setStorefiles(101).setStoreUncompressedSizeMB(106).setStorefileSizeMB(520)
-            .setStorefileIndexSizeMB(42).setRootIndexSizeKB(201).build();
+            .setStorefileIndexSizeMB(42).setRootIndexSizeKB(201).setReadRequestsCount(Integer.MAX_VALUE).setWriteRequestsCount(Integer.MAX_VALUE).build();
     ClusterStatusProtos.RegionLoad rlTwo =
         ClusterStatusProtos.RegionLoad.newBuilder().setRegionSpecifier(rSpecTwo).setStores(3)
             .setStorefiles(13).setStoreUncompressedSizeMB(23).setStorefileSizeMB(300)
-            .setStorefileIndexSizeMB(40).setRootIndexSizeKB(303).build();
+            .setStorefileIndexSizeMB(40).setRootIndexSizeKB(303).setReadRequestsCount(Integer.MAX_VALUE).setWriteRequestsCount(Integer.MAX_VALUE).build();
 
     ClusterStatusProtos.ServerLoad sl =
         ClusterStatusProtos.ServerLoad.newBuilder().addRegionLoads(rlOne).


Mime
View raw message