Package org.apache.hadoop.hbase.snapshot
Class SnapshotInfo
java.lang.Object
org.apache.hadoop.hbase.util.AbstractHBaseTool
org.apache.hadoop.hbase.snapshot.SnapshotInfo
- All Implemented Interfaces:
- org.apache.hadoop.conf.Configurable,- org.apache.hadoop.util.Tool
Tool for dumping snapshot information.
 
- Table Descriptor
- Snapshot creation time, type, format version, ...
- List of hfiles and wals
- Stats about hfiles and logs sizes, percentage of shared with the source table, ...
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescription(package private) static final classstatic classStatistics about the snapshot How many store files and logs are in the archive How many store files and logs are shared with the table Total store files and logs size and shared amountNested classes/interfaces inherited from class org.apache.hadoop.hbase.util.AbstractHBaseToolAbstractHBaseTool.OptionsOrderComparator
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate org.apache.hadoop.fs.FileSystemprivate booleanprivate static final org.slf4j.Loggerprivate booleanprivate org.apache.hadoop.fs.Pathprivate org.apache.hadoop.fs.Pathprivate booleanprivate booleanprivate booleanprivate SnapshotManifestprivate StringFields inherited from class org.apache.hadoop.hbase.util.AbstractHBaseToolcmdLineArgs, conf, EXIT_FAILURE, EXIT_SUCCESS, LONG_HELP_OPTION, options, SHORT_HELP_OPTION
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidOverride this to add command-line options usingAbstractHBaseTool.addOptWithArg(java.lang.String, java.lang.String)and similar methods.intdoWork()The "main function" of the toolprivate StringfileSizeToString(long size) private static voidgetSnapshotFilesMap(org.apache.hadoop.conf.Configuration conf, SnapshotDescription snapshot, ExecutorService exec, ConcurrentHashMap<org.apache.hadoop.fs.Path, Integer> filesMap, AtomicLong uniqueHFilesArchiveSize, AtomicLong uniqueHFilesSize, AtomicLong uniqueHFilesMobSize) Gets the store files map for snapshotstatic List<SnapshotDescription>getSnapshotList(org.apache.hadoop.conf.Configuration conf) Returns the list of available snapshots in the specified locationgetSnapshotsFilesMap(org.apache.hadoop.conf.Configuration conf, AtomicLong uniqueHFilesArchiveSize, AtomicLong uniqueHFilesSize, AtomicLong uniqueHFilesMobSize) Returns the map of store files based on path for all snapshotsstatic SnapshotInfo.SnapshotStatsgetSnapshotStats(org.apache.hadoop.conf.Configuration conf, SnapshotDescription snapshot) Returns the snapshot statsstatic SnapshotInfo.SnapshotStatsgetSnapshotStats(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshotDesc, Map<org.apache.hadoop.fs.Path, Integer> filesMap) Returns the snapshot statsprivate booleanloadSnapshotInfo(String snapshotName) Load snapshot info and table descriptor for the specified snapshotstatic voidprotected org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLineParserCreate the parser to use for parsing and validating the command line.private voidprintFiles(boolean showFiles, boolean showStats) Collect the hfiles and logs statistics of the snapshot and dump the file list if requested and the collected information.private voidDump theSnapshotDescriptionprivate voidDump theTableDescriptorprotected voidprotected voidprocessOptions(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd) This method is called to process the options after they have been parsed.Methods inherited from class org.apache.hadoop.hbase.util.AbstractHBaseTooladdOption, addOptNoArg, addOptNoArg, addOptWithArg, addOptWithArg, addRequiredOption, addRequiredOptWithArg, addRequiredOptWithArg, doStaticMain, getConf, getOptionAsDouble, getOptionAsInt, getOptionAsInt, getOptionAsLong, getOptionAsLong, parseArgs, parseInt, parseLong, printUsage, processOldArgs, run, setConf
- 
Field Details- 
LOG
- 
fs
- 
rootDir
- 
snapshotManifest
- 
listSnapshots
- 
snapshotName
- 
remoteDir
- 
showSchema
- 
showFiles
- 
showStats
- 
printSizeInBytes
 
- 
- 
Constructor Details- 
SnapshotInfopublic SnapshotInfo()
 
- 
- 
Method Details- 
doWorkDescription copied from class:AbstractHBaseToolThe "main function" of the tool- Specified by:
- doWorkin class- AbstractHBaseTool
- Throws:
- IOException
- InterruptedException
 
- 
loadSnapshotInfoLoad snapshot info and table descriptor for the specified snapshot- Parameters:
- snapshotName- name of the snapshot to load
- Returns:
- false if snapshot is not found
- Throws:
- IOException
 
- 
printInfoDump theSnapshotDescription
- 
printSchemaDump theTableDescriptor
- 
printFilesCollect the hfiles and logs statistics of the snapshot and dump the file list if requested and the collected information.- Throws:
- IOException
 
- 
fileSizeToString
- 
addOptionsDescription copied from class:AbstractHBaseToolOverride this to add command-line options usingAbstractHBaseTool.addOptWithArg(java.lang.String, java.lang.String)and similar methods.- Specified by:
- addOptionsin class- AbstractHBaseTool
 
- 
newParserDescription copied from class:AbstractHBaseToolCreate the parser to use for parsing and validating the command line. Since commons-cli lacks the capability to validate arbitrary combination of options, it may be helpful to bake custom logic into a specialized parser implementation. See LoadTestTool for examples.- Overrides:
- newParserin class- AbstractHBaseTool
- Returns:
- a new parser specific to the current tool
 
- 
processOptionsDescription copied from class:AbstractHBaseToolThis method is called to process the options after they have been parsed.- Specified by:
- processOptionsin class- AbstractHBaseTool
 
- 
printUsage- Overrides:
- printUsagein class- AbstractHBaseTool
 
- 
getSnapshotStatspublic static SnapshotInfo.SnapshotStats getSnapshotStats(org.apache.hadoop.conf.Configuration conf, SnapshotDescription snapshot) throws IOException Returns the snapshot stats- Parameters:
- conf- the- Configurationto use
- snapshot-- SnapshotDescriptionto get stats from
- Returns:
- the snapshot stats
- Throws:
- IOException
 
- 
getSnapshotStatspublic static SnapshotInfo.SnapshotStats getSnapshotStats(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshotDesc, Map<org.apache.hadoop.fs.Path, Integer> filesMap) throws IOExceptionReturns the snapshot stats- Parameters:
- conf- the- Configurationto use
- snapshotDesc- HBaseProtos.SnapshotDescription to get stats from
- filesMap-- Mapstore files map for all snapshots, it may be null
- Returns:
- the snapshot stats
- Throws:
- IOException
 
- 
getSnapshotListpublic static List<SnapshotDescription> getSnapshotList(org.apache.hadoop.conf.Configuration conf) throws IOException Returns the list of available snapshots in the specified location- Parameters:
- conf- the- Configurationto use
- Returns:
- the list of snapshots
- Throws:
- IOException
 
- 
getSnapshotFilesMapprivate static void getSnapshotFilesMap(org.apache.hadoop.conf.Configuration conf, SnapshotDescription snapshot, ExecutorService exec, ConcurrentHashMap<org.apache.hadoop.fs.Path, Integer> filesMap, AtomicLong uniqueHFilesArchiveSize, AtomicLong uniqueHFilesSize, AtomicLong uniqueHFilesMobSize) throws IOExceptionGets the store files map for snapshot- Parameters:
- conf- the- Configurationto use
- snapshot-- SnapshotDescriptionto get stats from
- exec- the- ExecutorServiceto use
- filesMap-- Mapthe map to put the mapping entries
- uniqueHFilesArchiveSize-- AtomicLongthe accumulated store file size in archive
- uniqueHFilesSize-- AtomicLongthe accumulated store file size shared
- uniqueHFilesMobSize-- AtomicLongthe accumulated mob store file size shared
- Throws:
- IOException
 
- 
getSnapshotsFilesMappublic static Map<org.apache.hadoop.fs.Path,Integer> getSnapshotsFilesMap(org.apache.hadoop.conf.Configuration conf, AtomicLong uniqueHFilesArchiveSize, AtomicLong uniqueHFilesSize, AtomicLong uniqueHFilesMobSize) throws IOException Returns the map of store files based on path for all snapshots- Parameters:
- conf- the- Configurationto use
- uniqueHFilesArchiveSize- pass out the size for store files in archive
- uniqueHFilesSize- pass out the size for store files shared
- uniqueHFilesMobSize- pass out the size for mob store files shared
- Returns:
- the map of store files
- Throws:
- IOException
 
- 
main
 
-