Package org.apache.hadoop.hbase.io.hfile
Class HFilePrettyPrinter
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.hbase.io.hfile.HFilePrettyPrinter
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable
,org.apache.hadoop.util.Tool
@LimitedPrivate("Tools")
@Evolving
public class HFilePrettyPrinter
extends org.apache.hadoop.conf.Configured
implements org.apache.hadoop.util.Tool
Implements pretty-printing functionality for
HFile
s.-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
Holds a Histogram and supporting min/max and range buckets for analyzing distribution of key bytes, value bytes, row bytes, and row columns.private static class
private static final class
Simple reporter which collects registered histograms for printing to an output stream inHFilePrettyPrinter.SimpleReporter.report()
. -
Field Summary
Modifier and TypeFieldDescriptionprivate boolean
private boolean
private boolean
private int
private PrintStream
private List<org.apache.hadoop.fs.Path>
private static final int
private static final String
private boolean
private static final org.slf4j.Logger
private static final int
private org.apache.hbase.thirdparty.org.apache.commons.cli.Options
private PrintStream
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private static final long[]
private byte[]
The row which the user wants to specify and print all the KeyValues for.private boolean
private static final com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Histogram>
private boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static String
asSeparateLines
(String keyValueStr) Format a string of the form "k1=v1, k2=v2, ..." into separate lines with a four-space indentation.private void
evictMobFilesIfNecessary
(Set<String> mobFileNames, int limit) Evicts the cached mob files if the set is larger than the limit.private void
init()
static void
private boolean
mobFileExists
(org.apache.hadoop.fs.FileSystem fs, TableName tn, String mobFileName, String family, Set<String> foundMobFiles, Set<String> missingMobFiles) Checks whether the referenced mob file exists.boolean
parseOptions
(String[] args) private void
printMeta
(HFile.Reader reader, Map<byte[], byte[]> fileInfo) int
processFile
(org.apache.hadoop.fs.Path file, boolean checkRootDir) int
Runs the command-line pretty-printer, and returns the desired command exit code (zero for success, non-zero for failure).private void
scanKeysValues
(org.apache.hadoop.fs.Path file, HFilePrettyPrinter.KeyValueStatsCollector fileStats, HFileScanner scanner, byte[] row) void
setPrintStreams
(PrintStream out, PrintStream err) Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConf
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.hadoop.conf.Configurable
getConf, setConf
-
Field Details
-
LOG
-
options
-
verbose
-
printValue
-
printKey
-
shouldPrintMeta
-
printBlockIndex
-
printBlockHeaders
-
printStats
-
printStatRanges
-
checkRow
-
checkFamily
-
isSeekToRow
-
checkMobIntegrity
-
mobFileLocations
-
FOUND_MOB_FILES_CACHE_CAPACITY
- See Also:
-
MISSING_MOB_FILES_CACHE_CAPACITY
- See Also:
-
out
-
err
-
row
The row which the user wants to specify and print all the KeyValues for. -
files
-
count
-
FOUR_SPACES
- See Also:
-
UNIFORM_RESERVOIR
private static final com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Histogram> UNIFORM_RESERVOIR -
RANGES
-
-
Constructor Details
-
HFilePrettyPrinter
public HFilePrettyPrinter() -
HFilePrettyPrinter
-
-
Method Details
-
init
-
setPrintStreams
-
parseOptions
public boolean parseOptions(String[] args) throws org.apache.hbase.thirdparty.org.apache.commons.cli.ParseException, IOException - Throws:
org.apache.hbase.thirdparty.org.apache.commons.cli.ParseException
IOException
-
run
Runs the command-line pretty-printer, and returns the desired command exit code (zero for success, non-zero for failure).- Specified by:
run
in interfaceorg.apache.hadoop.util.Tool
-
processFile
- Throws:
IOException
-
scanKeysValues
private void scanKeysValues(org.apache.hadoop.fs.Path file, HFilePrettyPrinter.KeyValueStatsCollector fileStats, HFileScanner scanner, byte[] row) throws IOException - Throws:
IOException
-
mobFileExists
private boolean mobFileExists(org.apache.hadoop.fs.FileSystem fs, TableName tn, String mobFileName, String family, Set<String> foundMobFiles, Set<String> missingMobFiles) throws IOException Checks whether the referenced mob file exists.- Throws:
IOException
-
evictMobFilesIfNecessary
Evicts the cached mob files if the set is larger than the limit. -
asSeparateLines
Format a string of the form "k1=v1, k2=v2, ..." into separate lines with a four-space indentation. -
printMeta
- Throws:
IOException
-
main
- Throws:
Exception
-