@InterfaceAudience.LimitedPrivate(value="Tools") @InterfaceStability.Evolving public class WALPrettyPrinter extends Object
Modifier and Type | Field and Description |
---|---|
private boolean |
firstTxn |
private static org.apache.hbase.thirdparty.com.google.gson.Gson |
GSON |
private static org.slf4j.Logger |
LOG |
private PrintStream |
out |
private boolean |
outputJSON |
private static String |
outputTmpl |
private boolean |
outputValues |
private boolean |
persistentOutput |
private long |
position |
private String |
region |
private String |
row |
private long |
sequence |
private String |
table |
Constructor and Description |
---|
WALPrettyPrinter()
Basic constructor that simply initializes values to reasonable defaults.
|
WALPrettyPrinter(boolean outputValues,
boolean outputJSON,
long sequence,
String table,
String region,
String row,
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) |
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 |
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 region by which output will be filtered
|
void |
setSequenceFilter(long sequence)
sets the region by which output will be filtered
|
void |
setTableFilter(String table)
Sets the table filter.
|
private static Map<String,Object> |
toStringMap(Cell cell) |
private static final org.slf4j.Logger LOG
private static final String outputTmpl
private boolean outputValues
private boolean outputJSON
private long sequence
private boolean persistentOutput
private boolean firstTxn
private PrintStream out
private static final org.apache.hbase.thirdparty.com.google.gson.Gson GSON
private long position
public WALPrettyPrinter()
public WALPrettyPrinter(boolean outputValues, boolean outputJSON, long sequence, String table, String region, String row, 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 printedtable
- when non null, serves as a filter. only entries corresponding to this
table will be printed.region
- 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 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 table)
table
- table name to set.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 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.private static Map<String,Object> toStringMap(Cell cell)
public static void main(String[] args) throws IOException
IOException
public static void run(String[] args) throws IOException
stdout
.args
- Command line argumentsIOException
- Thrown upon file system errors etc.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.