hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mberto...@apache.org
Subject [12/50] [abbrv] hbase git commit: HBASE-11864 Enhance HLogPrettyPrinter to print information from WAL Header (Chuhan Yang)
Date Thu, 09 Apr 2015 20:59:17 GMT
HBASE-11864 Enhance HLogPrettyPrinter to print information from WAL Header (Chuhan Yang)


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

Branch: refs/heads/hbase-12439
Commit: a9d7c49a59087008986334e8a9e4d0d1f5115acd
Parents: b6756b3
Author: tedyu <yuzhihong@gmail.com>
Authored: Wed Apr 8 06:15:55 2015 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Wed Apr 8 06:15:55 2015 -0700

----------------------------------------------------------------------
 .../regionserver/wal/ProtobufLogReader.java     | 15 +++++++++++-
 .../wal/SecureProtobufLogReader.java            |  2 +-
 .../hadoop/hbase/wal/WALPrettyPrinter.java      | 25 +++++++++++++++++++-
 3 files changed, 39 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/a9d7c49a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogReader.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogReader.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogReader.java
index 285f69b..af8b5bb 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogReader.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogReader.java
@@ -91,6 +91,9 @@ public class ProtobufLogReader extends ReaderBase {
   static {
     writerClsNames.add(ProtobufLogWriter.class.getSimpleName());
   }
+  
+  // cell codec classname
+  private String codecClsName = null;
 
   enum WALHdrResult {
     EOF,                   // stream is at EOF when method starts
@@ -153,9 +156,16 @@ public class ProtobufLogReader extends ReaderBase {
   /*
    * Returns names of the accepted writer classes
    */
-  protected List<String> getWriterClsNames() {
+  public List<String> getWriterClsNames() {
     return writerClsNames;
   }
+  
+  /*
+   * Returns the cell codec classname
+   */
+  public String getCodecClsName() {
+      return codecClsName;
+  }
 
   protected WALHdrContext readHeader(Builder builder, FSDataInputStream stream)
       throws IOException {
@@ -207,6 +217,9 @@ public class ProtobufLogReader extends ReaderBase {
       LOG.trace("After reading the trailer: walEditsStopOffset: " + this.walEditsStopOffset
           + ", fileLength: " + this.fileLength + ", " + "trailerPresent: " + trailerPresent);
     }
+    
+    codecClsName = hdrCtxt.getCellCodecClsName();
+    
     return hdrCtxt.getCellCodecClsName();
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/a9d7c49a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SecureProtobufLogReader.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SecureProtobufLogReader.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SecureProtobufLogReader.java
index d175741..0d052d4 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SecureProtobufLogReader.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SecureProtobufLogReader.java
@@ -51,7 +51,7 @@ public class SecureProtobufLogReader extends ProtobufLogReader {
   }
 
   @Override
-  protected List<String> getWriterClsNames() {
+  public List<String> getWriterClsNames() {
     return writerClsNames;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/a9d7c49a/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 f0d1e67..e579164 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
@@ -47,6 +47,7 @@ import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.FSUtils;
 import org.codehaus.jackson.map.ObjectMapper;
 
+import org.apache.hadoop.hbase.regionserver.wal.ProtobufLogReader;
 // imports for things that haven't moved yet.
 import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
 
@@ -242,11 +243,33 @@ public class WALPrettyPrinter {
     if (!fs.isFile(p)) {
       throw new IOException(p + " is not a file");
     }
+
+    WAL.Reader log = WALFactory.createReader(fs, p, conf);
+    
+    if (log instanceof ProtobufLogReader) {
+      List<String> writerClsNames = ((ProtobufLogReader) log).getWriterClsNames();
+      if (writerClsNames != null && writerClsNames.size() > 0) {
+        out.print("Writer Classes: ");
+        for (int i = 0; i < writerClsNames.size(); i++) {
+          out.print(writerClsNames.get(i));
+          if (i != writerClsNames.size() - 1) {
+            out.print(" ");
+          }
+        }
+        out.println();
+      }
+      
+      String cellCodecClsName = ((ProtobufLogReader) log).getCodecClsName();
+      if (cellCodecClsName != null) {
+        out.println("Cell Codec Class: " + cellCodecClsName);
+      }
+    }
+    
     if (outputJSON && !persistentOutput) {
       out.print("[");
       firstTxn = true;
     }
-    WAL.Reader log = WALFactory.createReader(fs, p, conf);
+    
     try {
       WAL.Entry entry;
       while ((entry = log.next()) != null) {


Mime
View raw message