@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 boolean |
outputOnlyRowKey |
private static String |
outputTmpl |
private boolean |
outputValues |
private boolean |
persistentOutput |
private long |
position |
private String |
region |
private String |
row |
private String |
rowPrefix |
private long |
sequence |
private Set<String> |
tableSet |
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 n * the HBase configuration relevant to this log file n * the path
of the log file to be read n * may be unable to access the configured filesystem or requested
file.
|
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 n * initial position to start seeking the given
WAL file
|
void |
setRegionFilter(String region)
sets the region by which output will be filtered n * when not null, serves as a filter; only
log entries from this region will be printed
|
void |
setRowFilter(String row)
sets the row key by which output will be filtered n * when not null, serves as a filter; only
log entries from this row will be printed
|
void |
setRowPrefixFilter(String rowPrefix)
sets the rowPrefix key prefix by which output will be filtered n * when not null, serves as a
filter; only log entries with rows having this prefix will be printed
|
void |
setSequenceFilter(long sequence)
sets the region by which output will be filtered n * when nonnegative, serves as a filter; only
log entries with this sequence id will be printed
|
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) |
private static final org.slf4j.Logger LOG
private static final String outputTmpl
private boolean outputValues
private boolean outputJSON
private long sequence
private boolean outputOnlyRowKey
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, Set<String> tableSet, String region, String row, String rowPrefix, boolean outputOnlyRowKey, boolean persistentOutput, PrintStream out)
public void enableValues()
public void disableValues()
public void enableJSON()
public void disableJSON()
public void setSequenceFilter(long sequence)
public void setTableFilter(String tablesWithDelimiter)
tablesWithDelimiter
- table names separated with comma.public void setRegionFilter(String region)
public void setRowFilter(String row)
public void setRowPrefixFilter(String rowPrefix)
public void setOutputOnlyRowKey()
public void setPosition(long position)
public void beginPersistentOutput()
public void endPersistentOutput()
public void processFile(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path p) throws IOException
IOException
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 Map<String,Object> toStringMap(Cell cell)
public static void main(String[] args) throws IOException
IOException
public static void run(String[] args) throws IOException
stdout
. n * Command line arguments n * Thrown upon file system
errors etc.IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.