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

Riley Patterson commented on HBASE-3968:
----------------------------------------

toStringBinary produces \x(hex value) for non-ascii characters, and the 
JSONObject further escapes this "\" -> "\\".  This is desired behavior because 
when a JSON parser parses the string, it will decode this back to one backslash 
and the string can be parsed from there. It looks like the JSON standard 
doesn't support the \x notation, so this seemed like the best approach.

I suppose the "Put" part of that line is not strictly necessary, but yes, I did 
mean that the following information represents a single put transaction.

I apologize about the license; I'll make sure to add that next time.

It does, in fact, work! Here are two examples, one with pretty printing and the 
other with JSON output:

> HLog --dump logfilepath -p -w rpatt
Sequence 33 from region people,,1308955768047.c2bce8f6ab585127f13f37c59d23fe26. 
in table people
  Put action:
    row: rpatt
    column: name:first
    at time: Mon Jun 27 11:06:46 PDT 2011
    value: Riley
Sequence 34 from region people,,1308955768047.c2bce8f6ab585127f13f37c59d23fe26. 
in table people
  Put action:
    row: rpatt
    column: name:last
    at time: Mon Jun 27 11:06:56 PDT 2011
    value: Patterson

> HLog --dump logfilepath -p -j -w rpatt
[{"region":"people,,1308955768047.c2bce8f6ab585127f13f37c59d23fe26.","sequence":33,"table":"people","actions":[{"timestamp":1309198006569,"family":"name","qualifier":"first","row":"rpatt","value":"Riley"}]},{"region":"people,,1308955768047.c2bce8f6ab585127f13f37c59d23fe26.","sequence":34,"table":"people","actions":[{"timestamp":1309198016702,"family":"name","qualifier":"last","row":"rpatt","value":"Patterson"}]}]

Thanks for your feedback!

> HLog Pretty Printer
> -------------------
>
>                 Key: HBASE-3968
>                 URL: https://issues.apache.org/jira/browse/HBASE-3968
>             Project: HBase
>          Issue Type: New Feature
>          Components: io, regionserver, util
>            Reporter: Nicolas Spiegelberg
>            Assignee: Riley Patterson
>            Priority: Minor
>              Labels: hbase
>         Attachments: HBASE-3968.patch
>
>
> We currently have a rudimentary way to print HLog data, but it is limited and 
> currently prints key-only information. We need extend this functionality, 
> similar to how we developed HFile's pretty printer. Ideas for functionality:
> - filter by sequence_id
> - filter by row / region
> - option to print values in addition to key info
> - option to print output in JSON format (so scripts can easily parse for 
> analysis)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to