From d26e22d75b581f834d34eb7b179ac4f4fe92fb88 Mon Sep 17 00:00:00 2001 From: Andy Yang Date: Mon, 28 Aug 2017 05:00:54 -0700 Subject: [PATCH] HBASE-3935 HServerLoad.storefileIndexSizeMB should be changed to storefileIndexSizeKB Signed-off-by: Chia-Ping Tsai --- .../org/apache/hadoop/hbase/RegionLoad.java | 16 +++++++--- .../org/apache/hadoop/hbase/ServerLoad.java | 17 +++++----- .../src/main/protobuf/ClusterStatus.proto | 4 +-- .../src/main/protobuf/ClusterStatus.proto | 4 +-- .../rest/StorageClusterStatusResource.java | 2 +- .../rest/model/StorageClusterStatusModel.java | 32 +++++++++---------- .../StorageClusterStatusMessage.proto | 2 +- .../model/TestStorageClusterStatusModel.java | 12 +++---- .../hbase/regionserver/HRegionServer.java | 6 ++-- .../apache/hadoop/hbase/TestServerLoad.java | 6 ++-- 10 files changed, 55 insertions(+), 46 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java index d6c028d053a..35cb69b3b78 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java @@ -84,10 +84,18 @@ public class RegionLoad { } /** - * @return the approximate size of storefile indexes on the heap, in MB + * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 + * ((HBASE-3935)). + * Use {@link #getStorefileIndexSizeKB()} instead. */ + @Deprecated public int getStorefileIndexSizeMB() { - return regionLoadPB.getStorefileIndexSizeMB(); + // Return value divided by 1024 + return (int) (regionLoadPB.getStorefileIndexSizeKB() >> 10); + } + + public long getStorefileIndexSizeKB() { + return regionLoadPB.getStorefileIndexSizeKB(); } /** @@ -215,8 +223,8 @@ public class RegionLoad { } sb = Strings.appendKeyValue(sb, "memstoreSizeMB", this.getMemStoreSizeMB()); - sb = Strings.appendKeyValue(sb, "storefileIndexSizeMB", - this.getStorefileIndexSizeMB()); + sb = Strings.appendKeyValue(sb, "storefileIndexSizeKB", + this.getStorefileIndexSizeKB()); sb = Strings.appendKeyValue(sb, "readRequestsCount", this.getReadRequestsCount()); sb = Strings.appendKeyValue(sb, "writeRequestsCount", 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 8d4c7d36482..521c079ea92 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,7 +45,7 @@ public class ServerLoad { private int storeUncompressedSizeMB = 0; private int storefileSizeMB = 0; private int memstoreSizeMB = 0; - private int storefileIndexSizeMB = 0; + private long storefileIndexSizeKB = 0; private long readRequestsCount = 0; private long filteredReadRequestsCount = 0; private long writeRequestsCount = 0; @@ -64,7 +64,7 @@ public class ServerLoad { storeUncompressedSizeMB += rl.getStoreUncompressedSizeMB(); storefileSizeMB += rl.getStorefileSizeMB(); memstoreSizeMB += rl.getMemstoreSizeMB(); - storefileIndexSizeMB += rl.getStorefileIndexSizeMB(); + storefileIndexSizeKB += rl.getStorefileIndexSizeKB(); readRequestsCount += rl.getReadRequestsCount(); filteredReadRequestsCount += rl.getFilteredReadRequestsCount(); writeRequestsCount += rl.getWriteRequestsCount(); @@ -159,15 +159,16 @@ public class ServerLoad { /** * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0 - * Use {@link #getStorefileIndexSizeMB()} instead. + * Use {@link #getStorefileIndexSizeKB()} instead. */ @Deprecated public int getStorefileIndexSizeInMB() { - return storefileIndexSizeMB; + // Return value divided by 1024 + return (int) (getStorefileIndexSizeKB() >> 10); } - public int getStorefileIndexSizeMB() { - return storefileIndexSizeMB; + public long getStorefileIndexSizeKB() { + return storefileIndexSizeKB; } public long getReadRequestsCount() { @@ -327,8 +328,8 @@ public class ServerLoad { } sb = Strings.appendKeyValue(sb, "memstoreSizeMB", Integer.valueOf(this.memstoreSizeMB)); sb = - Strings.appendKeyValue(sb, "storefileIndexSizeMB", - Integer.valueOf(this.storefileIndexSizeMB)); + Strings.appendKeyValue(sb, "storefileIndexSizeKB", + Long.valueOf(this.storefileIndexSizeKB)); sb = Strings.appendKeyValue(sb, "readRequestsCount", Long.valueOf(this.readRequestsCount)); sb = Strings.appendKeyValue(sb, "filteredReadRequestsCount", Long.valueOf(this.filteredReadRequestsCount)); diff --git a/hbase-protocol-shaded/src/main/protobuf/ClusterStatus.proto b/hbase-protocol-shaded/src/main/protobuf/ClusterStatus.proto index d647bb1fa60..51489b2a8e8 100644 --- a/hbase-protocol-shaded/src/main/protobuf/ClusterStatus.proto +++ b/hbase-protocol-shaded/src/main/protobuf/ClusterStatus.proto @@ -98,9 +98,9 @@ message RegionLoad { /** * The current total size of root-level store file indexes for the region, - * in MB. The same as {@link #rootIndexSizeKB} but in MB. + * in KB. The same as {@link #rootIndexSizeKB}. */ - optional uint32 storefile_index_size_MB = 7; + optional uint64 storefile_index_size_KB = 7; /** the current total read requests made to region */ optional uint64 read_requests_count = 8; diff --git a/hbase-protocol/src/main/protobuf/ClusterStatus.proto b/hbase-protocol/src/main/protobuf/ClusterStatus.proto index 4ae3230aebc..1bf128c61b8 100644 --- a/hbase-protocol/src/main/protobuf/ClusterStatus.proto +++ b/hbase-protocol/src/main/protobuf/ClusterStatus.proto @@ -98,9 +98,9 @@ message RegionLoad { /** * The current total size of root-level store file indexes for the region, - * in MB. The same as {@link #rootIndexSizeKB} but in MB. + * in KB. The same as {@link #rootIndexSizeKB}. */ - optional uint32 storefile_index_size_MB = 7; + optional uint64 storefile_index_size_KB = 7; /** the current total read requests made to region */ optional uint64 read_requests_count = 8; diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/StorageClusterStatusResource.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/StorageClusterStatusResource.java index 27977c3db01..29e95e985fb 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/StorageClusterStatusResource.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/StorageClusterStatusResource.java @@ -85,7 +85,7 @@ public class StorageClusterStatusResource extends ResourceBase { for (RegionLoad region: load.getRegionsLoad().values()) { node.addRegion(region.getName(), region.getStores(), region.getStorefiles(), region.getStorefileSizeMB(), - region.getMemStoreSizeMB(), region.getStorefileIndexSizeMB(), + region.getMemStoreSizeMB(), region.getStorefileIndexSizeKB(), region.getReadRequestsCount(), region.getWriteRequestsCount(), region.getRootIndexSizeKB(), region.getTotalStaticIndexSizeKB(), region.getTotalStaticBloomSizeKB(), region.getTotalCompactingKVs(), diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/StorageClusterStatusModel.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/StorageClusterStatusModel.java index 3c3c50e2a40..1a47232bb78 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/StorageClusterStatusModel.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/StorageClusterStatusModel.java @@ -115,7 +115,7 @@ public class StorageClusterStatusModel private int storefiles; private int storefileSizeMB; private int memstoreSizeMB; - private int storefileIndexSizeMB; + private long storefileIndexSizeKB; private long readRequestsCount; private long writeRequestsCount; private int rootIndexSizeKB; @@ -145,10 +145,10 @@ public class StorageClusterStatusModel * @param storefiles the number of store files * @param storefileSizeMB total size of store files, in MB * @param memstoreSizeMB total size of memstore, in MB - * @param storefileIndexSizeMB total size of store file indexes, in MB + * @param storefileIndexSizeKB total size of store file indexes, in KB */ public Region(byte[] name, int stores, int storefiles, - int storefileSizeMB, int memstoreSizeMB, int storefileIndexSizeMB, + int storefileSizeMB, int memstoreSizeMB, long storefileIndexSizeKB, long readRequestsCount, long writeRequestsCount, int rootIndexSizeKB, int totalStaticIndexSizeKB, int totalStaticBloomSizeKB, long totalCompactingKVs, long currentCompactedKVs) { @@ -157,7 +157,7 @@ public class StorageClusterStatusModel this.storefiles = storefiles; this.storefileSizeMB = storefileSizeMB; this.memstoreSizeMB = memstoreSizeMB; - this.storefileIndexSizeMB = storefileIndexSizeMB; + this.storefileIndexSizeKB = storefileIndexSizeKB; this.readRequestsCount = readRequestsCount; this.writeRequestsCount = writeRequestsCount; this.rootIndexSizeKB = rootIndexSizeKB; @@ -208,11 +208,11 @@ public class StorageClusterStatusModel } /** - * @return the total size of store file indexes, in MB + * @return the total size of store file indexes, in KB */ @XmlAttribute - public int getStorefileIndexSizeMB() { - return storefileIndexSizeMB; + public long getStorefileIndexSizeKB() { + return storefileIndexSizeKB; } /** @@ -361,10 +361,10 @@ public class StorageClusterStatusModel } /** - * @param storefileIndexSizeMB total size of store file indexes, in MB + * @param storefileIndexSizeKB total size of store file indexes, in KB */ - public void setStorefileIndexSizeMB(int storefileIndexSizeMB) { - this.storefileIndexSizeMB = storefileIndexSizeMB; + public void setStorefileIndexSizeKB(long storefileIndexSizeKB) { + this.storefileIndexSizeKB = storefileIndexSizeKB; } } @@ -380,12 +380,12 @@ public class StorageClusterStatusModel * @param name the region name */ public void addRegion(byte[] name, int stores, int storefiles, - int storefileSizeMB, int memstoreSizeMB, int storefileIndexSizeMB, + int storefileSizeMB, int memstoreSizeMB, long storefileIndexSizeKB, long readRequestsCount, long writeRequestsCount, int rootIndexSizeKB, int totalStaticIndexSizeKB, int totalStaticBloomSizeKB, long totalCompactingKVs, long currentCompactedKVs) { regions.add(new Region(name, stores, storefiles, storefileSizeMB, - memstoreSizeMB, storefileIndexSizeMB, readRequestsCount, + memstoreSizeMB, storefileIndexSizeKB, readRequestsCount, writeRequestsCount, rootIndexSizeKB, totalStaticIndexSizeKB, totalStaticBloomSizeKB, totalCompactingKVs, currentCompactedKVs)); } @@ -673,8 +673,8 @@ public class StorageClusterStatusModel sb.append(region.storefileSizeMB); sb.append("\n memstoreSizeMB="); sb.append(region.memstoreSizeMB); - sb.append("\n storefileIndexSizeMB="); - sb.append(region.storefileIndexSizeMB); + sb.append("\n storefileIndexSizeKB="); + sb.append(region.storefileIndexSizeKB); sb.append("\n readRequestsCount="); sb.append(region.readRequestsCount); sb.append("\n writeRequestsCount="); @@ -729,7 +729,7 @@ public class StorageClusterStatusModel regionBuilder.setStorefiles(region.storefiles); regionBuilder.setStorefileSizeMB(region.storefileSizeMB); regionBuilder.setMemstoreSizeMB(region.memstoreSizeMB); - regionBuilder.setStorefileIndexSizeMB(region.storefileIndexSizeMB); + regionBuilder.setStorefileIndexSizeKB(region.storefileIndexSizeKB); regionBuilder.setReadRequestsCount(region.readRequestsCount); regionBuilder.setWriteRequestsCount(region.writeRequestsCount); regionBuilder.setRootIndexSizeKB(region.rootIndexSizeKB); @@ -775,7 +775,7 @@ public class StorageClusterStatusModel region.getStorefiles(), region.getStorefileSizeMB(), region.getMemstoreSizeMB(), - region.getStorefileIndexSizeMB(), + region.getStorefileIndexSizeKB(), region.getReadRequestsCount(), region.getWriteRequestsCount(), region.getRootIndexSizeKB(), diff --git a/hbase-rest/src/main/protobuf/StorageClusterStatusMessage.proto b/hbase-rest/src/main/protobuf/StorageClusterStatusMessage.proto index 34dc1c32b0d..f69efd7706c 100644 --- a/hbase-rest/src/main/protobuf/StorageClusterStatusMessage.proto +++ b/hbase-rest/src/main/protobuf/StorageClusterStatusMessage.proto @@ -24,7 +24,7 @@ message StorageClusterStatus { optional int32 storefiles = 3; optional int32 storefileSizeMB = 4; optional int32 memstoreSizeMB = 5; - optional int32 storefileIndexSizeMB = 6; + optional int64 storefileIndexSizeKB = 6; optional int64 readRequestsCount = 7; optional int64 writeRequestsCount = 8; optional int32 rootIndexSizeKB = 9; diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/model/TestStorageClusterStatusModel.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/model/TestStorageClusterStatusModel.java index 36850a5b438..884e451072c 100644 --- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/model/TestStorageClusterStatusModel.java +++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/model/TestStorageClusterStatusModel.java @@ -40,12 +40,12 @@ public class TestStorageClusterStatusModel extends TestModelBase" + "" + "" + "" + "" + ""; @@ -61,13 +61,13 @@ public class TestStorageClusterStatusModel extends TestModelBase