HBASE-3935 HServerLoad.storefileIndexSizeMB should be changed to storefileIndexSizeKB

Signed-off-by: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
Andy Yang 2017-08-28 05:00:54 -07:00 committed by Chia-Ping Tsai
parent cc0e630d2b
commit d26e22d75b
10 changed files with 55 additions and 46 deletions

View File

@ -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
* ((<a href="https://issues.apache.org/jira/browse/HBASE-3935">HBASE-3935</a>)).
* 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",

View File

@ -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));

View File

@ -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;

View File

@ -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;

View File

@ -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(),

View File

@ -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(),

View File

@ -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;

View File

@ -40,12 +40,12 @@ public class TestStorageClusterStatusModel extends TestModelBase<StorageClusterS
"<DeadNodes/><LiveNodes>" +
"<Node heapSizeMB=\"128\" maxHeapSizeMB=\"1024\" name=\"test1\" requests=\"0\" startCode=\"1245219839331\">" +
"<Region currentCompactedKVs=\"1\" memstoreSizeMB=\"0\" name=\"aGJhc2U6cm9vdCwsMA==\" readRequestsCount=\"1\" " +
"rootIndexSizeKB=\"1\" storefileIndexSizeMB=\"0\" storefileSizeMB=\"0\" storefiles=\"1\" stores=\"1\" " +
"rootIndexSizeKB=\"1\" storefileIndexSizeKB=\"0\" storefileSizeMB=\"0\" storefiles=\"1\" stores=\"1\" " +
"totalCompactingKVs=\"1\" totalStaticBloomSizeKB=\"1\" totalStaticIndexSizeKB=\"1\" writeRequestsCount=\"2\"/>" +
"</Node>" +
"<Node heapSizeMB=\"512\" maxHeapSizeMB=\"1024\" name=\"test2\" requests=\"0\" startCode=\"1245239331198\">" +
"<Region currentCompactedKVs=\"1\" memstoreSizeMB=\"0\" name=\"aGJhc2U6bWV0YSwsMTI0NjAwMDA0MzcyNA==\" " +
"readRequestsCount=\"1\" rootIndexSizeKB=\"1\" storefileIndexSizeMB=\"0\" storefileSizeMB=\"0\" " +
"readRequestsCount=\"1\" rootIndexSizeKB=\"1\" storefileIndexSizeKB=\"0\" storefileSizeMB=\"0\" " +
"storefiles=\"1\" stores=\"1\" totalCompactingKVs=\"1\" totalStaticBloomSizeKB=\"1\" " +
"totalStaticIndexSizeKB=\"1\" writeRequestsCount=\"2\"/></Node></LiveNodes></ClusterStatus>";
@ -61,13 +61,13 @@ public class TestStorageClusterStatusModel extends TestModelBase<StorageClusterS
AS_JSON =
"{\"regions\":2,\"requests\":0,\"averageLoad\":1.0,\"LiveNodes\":[{\"name\":\"test1\"," +
"\"Region\":[{\"name\":\"aGJhc2U6cm9vdCwsMA==\",\"stores\":1,\"storefiles\":1," +
"\"storefileSizeMB\":0,\"memstoreSizeMB\":0,\"storefileIndexSizeMB\":0," +
"\"storefileSizeMB\":0,\"memstoreSizeMB\":0,\"storefileIndexSizeKB\":0," +
"\"readRequestsCount\":1,\"writeRequestsCount\":2,\"rootIndexSizeKB\":1," +
"\"totalStaticIndexSizeKB\":1,\"totalStaticBloomSizeKB\":1,\"totalCompactingKVs\":1," +
"\"currentCompactedKVs\":1}],\"requests\":0,\"startCode\":1245219839331," +
"\"heapSizeMB\":128,\"maxHeapSizeMB\":1024},{\"name\":\"test2\"," +
"\"Region\":[{\"name\":\"aGJhc2U6bWV0YSwsMTI0NjAwMDA0MzcyNA==\",\"stores\":1," +
"\"storefiles\":1,\"storefileSizeMB\":0,\"memstoreSizeMB\":0,\"storefileIndexSizeMB\":0," +
"\"storefiles\":1,\"storefileSizeMB\":0,\"memstoreSizeMB\":0,\"storefileIndexSizeKB\":0," +
"\"readRequestsCount\":1,\"writeRequestsCount\":2,\"rootIndexSizeKB\":1," +
"\"totalStaticIndexSizeKB\":1,\"totalStaticBloomSizeKB\":1,\"totalCompactingKVs\":1," +
"\"currentCompactedKVs\":1}],\"requests\":0,\"startCode\":1245239331198," +
@ -107,7 +107,7 @@ public class TestStorageClusterStatusModel extends TestModelBase<StorageClusterS
assertEquals(region.getStorefiles(), 1);
assertEquals(region.getStorefileSizeMB(), 0);
assertEquals(region.getMemstoreSizeMB(), 0);
assertEquals(region.getStorefileIndexSizeMB(), 0);
assertEquals(region.getStorefileIndexSizeKB(), 0);
assertEquals(region.getReadRequestsCount(), 1);
assertEquals(region.getWriteRequestsCount(), 2);
assertEquals(region.getRootIndexSizeKB(), 1);
@ -129,7 +129,7 @@ public class TestStorageClusterStatusModel extends TestModelBase<StorageClusterS
assertEquals(region.getStorefiles(), 1);
assertEquals(region.getStorefileSizeMB(), 0);
assertEquals(region.getMemstoreSizeMB(), 0);
assertEquals(region.getStorefileIndexSizeMB(), 0);
assertEquals(region.getStorefileIndexSizeKB(), 0);
assertEquals(region.getReadRequestsCount(), 1);
assertEquals(region.getWriteRequestsCount(), 2);
assertEquals(region.getRootIndexSizeKB(), 1);

View File

@ -1683,7 +1683,7 @@ public class HRegionServer extends HasThread implements
int storeUncompressedSizeMB = 0;
int storefileSizeMB = 0;
int memstoreSizeMB = (int) (r.getMemstoreSize() / 1024 / 1024);
int storefileIndexSizeMB = 0;
long storefileIndexSizeKB = 0;
int rootIndexSizeKB = 0;
int totalStaticIndexSizeKB = 0;
int totalStaticBloomSizeKB = 0;
@ -1695,7 +1695,7 @@ public class HRegionServer extends HasThread implements
storefiles += store.getStorefilesCount();
storeUncompressedSizeMB += (int) (store.getStoreSizeUncompressed() / 1024 / 1024);
storefileSizeMB += (int) (store.getStorefilesSize() / 1024 / 1024);
storefileIndexSizeMB += (int) (store.getStorefilesIndexSize() / 1024 / 1024);
storefileIndexSizeKB += store.getStorefilesIndexSize() / 1024;
CompactionProgress progress = store.getCompactionProgress();
if (progress != null) {
totalCompactingKVs += progress.totalCompactingKVs;
@ -1722,7 +1722,7 @@ public class HRegionServer extends HasThread implements
.setStoreUncompressedSizeMB(storeUncompressedSizeMB)
.setStorefileSizeMB(storefileSizeMB)
.setMemstoreSizeMB(memstoreSizeMB)
.setStorefileIndexSizeMB(storefileIndexSizeMB)
.setStorefileIndexSizeKB(storefileIndexSizeKB)
.setRootIndexSizeKB(rootIndexSizeKB)
.setTotalStaticIndexSizeKB(totalStaticIndexSizeKB)
.setTotalStaticBloomSizeKB(totalStaticBloomSizeKB)

View File

@ -42,7 +42,7 @@ public class TestServerLoad {
assertEquals(129, sl.getStoreUncompressedSizeMB());
assertEquals(504, sl.getRootIndexSizeKB());
assertEquals(820, sl.getStorefileSizeMB());
assertEquals(82, sl.getStorefileIndexSizeMB());
assertEquals(82, sl.getStorefileIndexSizeKB());
assertEquals(((long)Integer.MAX_VALUE)*2, sl.getReadRequestsCount());
assertEquals(300, sl.getFilteredReadRequestsCount());
@ -83,12 +83,12 @@ public class TestServerLoad {
ClusterStatusProtos.RegionLoad.newBuilder().setRegionSpecifier(rSpecOne).setStores(10)
.setStorefiles(101).setStoreUncompressedSizeMB(106).setStorefileSizeMB(520)
.setFilteredReadRequestsCount(100)
.setStorefileIndexSizeMB(42).setRootIndexSizeKB(201).setReadRequestsCount(Integer.MAX_VALUE).setWriteRequestsCount(Integer.MAX_VALUE).build();
.setStorefileIndexSizeKB(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)
.setFilteredReadRequestsCount(200)
.setStorefileIndexSizeMB(40).setRootIndexSizeKB(303).setReadRequestsCount(Integer.MAX_VALUE).setWriteRequestsCount(Integer.MAX_VALUE).build();
.setStorefileIndexSizeKB(40).setRootIndexSizeKB(303).setReadRequestsCount(Integer.MAX_VALUE).setWriteRequestsCount(Integer.MAX_VALUE).build();
ClusterStatusProtos.ServerLoad sl =
ClusterStatusProtos.ServerLoad.newBuilder().addRegionLoads(rlOne).