hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject hbase git commit: HBASE-21185 - WALPrettyPrinter: Additional useful info to be printed by wal printer tool, for debugability purposes
Date Thu, 11 Oct 2018 21:43:16 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.4 bd690be7a -> 59cb65aa3


HBASE-21185 - WALPrettyPrinter: Additional useful info to be printed by wal printer tool,
for debugability purposes


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

Branch: refs/heads/branch-1.4
Commit: 59cb65aa30be53dfbf9ff56ec6adef1255cd7e34
Parents: bd690be
Author: wellington <wchevreuil@cloudera.com>
Authored: Sat Oct 6 02:19:57 2018 +0100
Committer: Michael Stack <stack@apache.org>
Committed: Thu Oct 11 14:43:06 2018 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/wal/WALPrettyPrinter.java      | 24 ++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/59cb65aa/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALPrettyPrinter.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALPrettyPrinter.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALPrettyPrinter.java
index be83ae0..33522a8 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALPrettyPrinter.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALPrettyPrinter.java
@@ -81,6 +81,8 @@ public class WALPrettyPrinter {
   // for JSON encoding
   private static final ObjectMapper MAPPER = new ObjectMapper();
 
+  private long position;
+
   /**
    * Basic constructor that simply initializes values to reasonable defaults.
    */
@@ -121,7 +123,8 @@ public class WALPrettyPrinter {
    *          PrettyPrinter's output.
    */
   public WALPrettyPrinter(boolean outputValues, boolean outputJSON,
-      long sequence, String region, String row, boolean persistentOutput,
+      long sequence, String region, String row, boolean
+      persistentOutput,
       PrintStream out) {
     this.outputValues = outputValues;
     this.outputJSON = outputJSON;
@@ -269,7 +272,11 @@ public class WALPrettyPrinter {
       out.print("[");
       firstTxn = true;
     }
-    
+
+    if (position > 0) {
+      log.seek(position);
+    }
+
     try {
       WAL.Entry entry;
       while ((entry = log.next()) != null) {
@@ -293,6 +300,8 @@ public class WALPrettyPrinter {
           if (row == null || ((String) op.get("row")).equals(row)) {
             actions.add(op);
           }
+          op.put("total_size_sum", CellUtil.estimatedHeapSizeOf(cell));
+
         }
         if (actions.size() == 0)
           continue;
@@ -317,8 +326,11 @@ public class WALPrettyPrinter {
               out.println("    tag: " + op.get("tag"));
             }
             if (outputValues) out.println("    value: " + op.get("value"));
+            out.println("cell total size sum: " + op.get("total_size_sum"));
           }
         }
+        out.println("edit heap size: " + entry.getEdit().heapSize());
+        out.println("position: " + log.getPosition());
       }
     } finally {
       log.close();
@@ -377,6 +389,7 @@ public class WALPrettyPrinter {
     options.addOption("s", "sequence", true,
         "Sequence to filter by. Pass sequence number.");
     options.addOption("w", "row", true, "Row to filter by. Pass row name.");
+    options.addOption("g", "goto", true, "Position to seek to in the file");
 
     WALPrettyPrinter printer = new WALPrettyPrinter();
     CommandLineParser parser = new PosixParser();
@@ -400,6 +413,9 @@ public class WALPrettyPrinter {
         printer.setSequenceFilter(Long.parseLong(cmd.getOptionValue("s")));
       if (cmd.hasOption("w"))
         printer.setRowFilter(cmd.getOptionValue("w"));
+      if (cmd.hasOption("g")) {
+        printer.setPosition(Long.parseLong(cmd.getOptionValue("g")));
+      }
     } catch (ParseException e) {
       e.printStackTrace();
       HelpFormatter formatter = new HelpFormatter();
@@ -423,4 +439,8 @@ public class WALPrettyPrinter {
     }
     printer.endPersistentOutput();
   }
+
+  public void setPosition(long position) {
+    this.position = position;
+  }
 }


Mime
View raw message