[ 
https://issues.apache.org/jira/browse/HBASE-2889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12907102#action_12907102
 ] 

stack commented on HBASE-2889:
------------------------------

There is already

{code}
$ hbase/bin/hbase org.apache.hadoop.hbase.regionserver.wal.HLog --dump 
hdfs://example.com:9000/hbase/10.10.21.18%3A60020.1283907407862
{code}

Need to make it tail...

Also, need to add this to the dump command:

{code}
Index: src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
===================================================================
--- src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java    
(revision 993076)
+++ src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java    
(working copy)
@@ -1830,9 +1830,12 @@
         }
         Reader log = getReader(fs, logPath, conf);
         try {
+          int count = 0;
           HLog.Entry entry;
           while ((entry = log.next()) != null) {
-            System.out.println(entry.toString());
+            System.out.println("#" + count + ", pos=" + log.getPosition() +
+              " " + entry.toString());
+            count++;
           }
         } finally {
           log.close();
{code}

... so can see where emitted edit is in file.



> Tool to look at HLogs -- parse and tail -f
> ------------------------------------------
>
>                 Key: HBASE-2889
>                 URL: https://issues.apache.org/jira/browse/HBASE-2889
>             Project: HBase
>          Issue Type: Bug
>          Components: wal
>            Reporter: stack
>            Assignee: stack
>             Fix For: 0.90.0
>
>
> We need a tool for looking at wals.  A tail -f would be sweet though it might 
> be ugly having to open each time it wants to dump next lot of edits out wal 
> log.
> From Kannan:
> {code}20:45 <kannan> WALEdit already has a toString().
> 20:46 <kannan> And append/sync support allows you to read concurrently a file 
> that is being written too... (like JDs replication).
> 20:46 <kannan> So it would be good if I could do a bin/hbase hlogprint -f 
> hdfs://...../.logs/<filename> -v -p
> 20:46 <kannan> much like the HFile pretty printer... except the HLog one is 
> effectively a tail -f.
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to