HBASE-12961 Fix negative values in read and write region server metrics.
This commit is contained in:
parent
37ef793fab
commit
4f472062a4
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,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());
|
||||
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,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()
|
||||
|
@ -72,11 +80,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).
|
||||
|
|
Loading…
Reference in New Issue