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
HFiles.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classHolds a Histogram and supporting min/max and range buckets for analyzing distribution of key bytes, value bytes, row bytes, and row columns.private static classprivate static final classSimple reporter which collects registered histograms for printing to an output stream inHFilePrettyPrinter.SimpleReporter.report(). -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate booleanprivate booleanprivate intprivate PrintStreamprivate List<org.apache.hadoop.fs.Path>private static final intprivate static final Stringprivate booleanprivate static final org.slf4j.Loggerprivate static final intprivate org.apache.hbase.thirdparty.org.apache.commons.cli.Optionsprivate PrintStreamprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate static final long[]private byte[]The row which the user wants to specify and print all the KeyValues for.private booleanprivate static final com.codahale.metrics.MetricRegistry.MetricSupplier<com.codahale.metrics.Histogram>private boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringasSeparateLines(String keyValueStr) Format a string of the form "k1=v1, k2=v2, ..." into separate lines with a four-space indentation.private voidevictMobFilesIfNecessary(Set<String> mobFileNames, int limit) Evicts the cached mob files if the set is larger than the limit.private voidinit()static voidprivate booleanmobFileExists(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.booleanparseOptions(String[] args) private voidprintMeta(HFile.Reader reader, Map<byte[], byte[]> fileInfo) intprocessFile(org.apache.hadoop.fs.Path file, boolean checkRootDir) intRuns the command-line pretty-printer, and returns the desired command exit code (zero for success, non-zero for failure).private voidscanKeysValues(org.apache.hadoop.fs.Path file, HFilePrettyPrinter.KeyValueStatsCollector fileStats, HFileScanner scanner, byte[] row) voidsetPrintStreams(PrintStream out, PrintStream err) Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConfMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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.ParseExceptionIOException
-
run
Runs the command-line pretty-printer, and returns the desired command exit code (zero for success, non-zero for failure).- Specified by:
runin 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
-