@InterfaceAudience.LimitedPrivate(value="Tools") @InterfaceStability.Evolving public class WALPrettyPrinter extends Object
| Constructor and Description |
|---|
WALPrettyPrinter()
Basic constructor that simply initializes values to reasonable defaults.
|
WALPrettyPrinter(boolean outputValues,
boolean outputJSON,
long sequence,
Set<String> tableSet,
String region,
String row,
String rowPrefix,
boolean outputOnlyRowKey,
boolean persistentOutput,
PrintStream out)
Fully specified constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
beginPersistentOutput()
enables output as a single, persistent list.
|
void |
disableJSON()
turns JSON output off, and turns on "pretty strings" for human consumption
|
void |
disableValues()
turns value output off
|
void |
enableJSON()
turns JSON output on
|
void |
enableValues()
turns value output on
|
void |
endPersistentOutput()
ends output of a single, persistent list.
|
static void |
main(String[] args) |
static void |
printCell(PrintStream out,
Map<String,Object> op,
boolean outputValues,
boolean outputOnlyRowKey) |
void |
processFile(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path p)
reads a log file and outputs its contents, one transaction at a time, as
specified by the currently configured options
|
static void |
run(String[] args)
Pass one or more log file names and formatting options and it will dump out
a text version of the contents on
stdout. |
void |
setOutputOnlyRowKey()
Option to print the row key only in case you just need the row keys from the WAL
|
void |
setPosition(long position)
sets the position to start seeking the WAL file
|
void |
setRegionFilter(String region)
sets the region by which output will be filtered
|
void |
setRowFilter(String row)
sets the row key by which output will be filtered
|
void |
setRowPrefixFilter(String rowPrefix)
sets the rowPrefix key prefix by which output will be filtered
|
void |
setSequenceFilter(long sequence)
sets the region by which output will be filtered
|
void |
setTableFilter(String tablesWithDelimiter)
Sets the tables filter.
|
static Map<String,Object> |
toStringMap(Cell cell) |
static Map<String,Object> |
toStringMap(Cell cell,
boolean printRowKeyOnly,
String rowPrefix,
String row,
boolean outputValues) |
public WALPrettyPrinter()
public WALPrettyPrinter(boolean outputValues,
boolean outputJSON,
long sequence,
Set<String> tableSet,
String region,
String row,
String rowPrefix,
boolean outputOnlyRowKey,
boolean persistentOutput,
PrintStream out)
outputValues - when true, enables output of values along with other log
informationoutputJSON - when true, enables output in JSON format rather than a
"pretty string"sequence - when nonnegative, serves as a filter; only log entries with this
sequence id will be printedtableSet - when non null, serves as a filter. only entries corresponding to tables
in the tableSet are printedregion - when not null, serves as a filter; only log entries from this
region will be printedrow - when not null, serves as a filter; only log entries from this row
will be printedrowPrefix - when not null, serves as a filter; only log entries with row key
having this prefix will be printedpersistentOutput - keeps a single list running for multiple files. if enabled, the
endPersistentOutput() method must be used!out - Specifies an alternative to stdout for the destination of this
PrettyPrinter's output.public void enableValues()
public void disableValues()
public void enableJSON()
public void disableJSON()
public void setSequenceFilter(long sequence)
sequence - when nonnegative, serves as a filter; only log entries with this
sequence id will be printedpublic void setTableFilter(String tablesWithDelimiter)
tablesWithDelimiter - table names separated with comma.public void setRegionFilter(String region)
region - when not null, serves as a filter; only log entries from this
region will be printedpublic void setRowFilter(String row)
row - when not null, serves as a filter; only log entries from this row
will be printedpublic void setRowPrefixFilter(String rowPrefix)
rowPrefix - when not null, serves as a filter; only log entries from this rowPrefix
will be printedpublic void setOutputOnlyRowKey()
public void setPosition(long position)
position - initial position to start seeking the given WAL filepublic void beginPersistentOutput()
public void endPersistentOutput()
public void processFile(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path p)
throws IOException
conf - the HBase configuration relevant to this log filep - the path of the log file to be readIOException - may be unable to access the configured filesystem or requested
file.public static void printCell(PrintStream out, Map<String,Object> op, boolean outputValues, boolean outputOnlyRowKey)
public static Map<String,Object> toStringMap(Cell cell, boolean printRowKeyOnly, String rowPrefix, String row, boolean outputValues)
public static void main(String[] args) throws IOException
IOExceptionpublic static void run(String[] args) throws IOException
stdout.args - Command line argumentsIOException - Thrown upon file system errors etc.Copyright © 2007–2022 The Apache Software Foundation. All rights reserved.