hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anoopsamj...@apache.org
Subject svn commit: r1455583 - /hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java
Date Tue, 12 Mar 2013 15:26:26 GMT
Author: anoopsamjohn
Date: Tue Mar 12 15:26:26 2013
New Revision: 1455583

URL: http://svn.apache.org/r1455583
Log:
HBASE-8057 RegionLoad needs a toString implementation(jmspaggiari)

Modified:
    hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java

Modified: hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java?rev=1455583&r1=1455582&r2=1455583&view=diff
==============================================================================
--- hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java (original)
+++ hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java Tue Mar
12 15:26:26 2013
@@ -23,6 +23,7 @@ package org.apache.hadoop.hbase;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Strings;
 
 /**
   * Encapsulates per-region load metrics.
@@ -149,4 +150,57 @@ public class RegionLoad {
   public long getCompleteSequenceId() {
     return regionLoadPB.getCompleteSequenceId();
   }
+
+  /**
+   * @return the uncompressed size of the storefiles in MB.
+   */
+  public int getStoreUncompressedSizeMB() {
+    return regionLoadPB.getStoreUncompressedSizeMB();
+  }
+
+  /**
+   * @see java.lang.Object#toString()
+   */
+  @Override
+  public String toString() {
+    StringBuilder sb = Strings.appendKeyValue(new StringBuilder(), "numberOfStores",
+      Integer.valueOf(this.getStores()));
+    sb = Strings.appendKeyValue(sb, "numberOfStorefiles",
+      Integer.valueOf(this.getStorefiles()));
+    sb = Strings.appendKeyValue(sb, "storefileUncompressedSizeMB",
+      Integer.valueOf(this.getStoreUncompressedSizeMB()));
+    sb = Strings.appendKeyValue(sb, "storefileSizeMB",
+        Integer.valueOf(this.getStorefileSizeMB()));
+    if (this.getStoreUncompressedSizeMB() != 0) {
+      sb = Strings.appendKeyValue(sb, "compressionRatio",
+          String.format("%.4f", (float)this.getStorefileSizeMB()/
+              (float)this.getStoreUncompressedSizeMB()));
+    }
+    sb = Strings.appendKeyValue(sb, "memstoreSizeMB",
+      Integer.valueOf(this.getMemStoreSizeMB()));
+    sb = Strings.appendKeyValue(sb, "storefileIndexSizeMB",
+      Integer.valueOf(this.getStorefileIndexSizeMB()));
+    sb = Strings.appendKeyValue(sb, "readRequestsCount",
+        Long.valueOf(this.getReadRequestsCount()));
+    sb = Strings.appendKeyValue(sb, "writeRequestsCount",
+        Long.valueOf(this.getWriteRequestsCount()));
+    sb = Strings.appendKeyValue(sb, "rootIndexSizeKB",
+        Integer.valueOf(this.getRootIndexSizeKB()));
+    sb = Strings.appendKeyValue(sb, "totalStaticIndexSizeKB",
+        Integer.valueOf(this.getTotalStaticIndexSizeKB()));
+    sb = Strings.appendKeyValue(sb, "totalStaticBloomSizeKB",
+      Integer.valueOf(this.getTotalStaticBloomSizeKB()));
+    sb = Strings.appendKeyValue(sb, "totalCompactingKVs",
+        Long.valueOf(this.getTotalCompactingKVs()));
+    sb = Strings.appendKeyValue(sb, "currentCompactedKVs",
+        Long.valueOf(this.getCurrentCompactedKVs()));
+    float compactionProgressPct = Float.NaN;
+    if( this.getTotalCompactingKVs() > 0 ) {
+      compactionProgressPct = Float.valueOf(
+          this.getCurrentCompactedKVs() / this.getTotalCompactingKVs());
+    }
+    sb = Strings.appendKeyValue(sb, "compactionProgressPct",
+        compactionProgressPct);
+    return sb.toString();
+  }
 }



Mime
View raw message