@InterfaceAudience.Public public final class SnapshotInfo extends AbstractHBaseTool
Modifier and Type | Class and Description |
---|---|
(package private) static class |
SnapshotInfo.Options |
static class |
SnapshotInfo.SnapshotStats
Statistics 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 amount
|
AbstractHBaseTool.OptionsOrderComparator
Modifier and Type | Field and Description |
---|---|
private org.apache.hadoop.fs.FileSystem |
fs |
private boolean |
listSnapshots |
private static org.slf4j.Logger |
LOG |
private boolean |
printSizeInBytes |
private org.apache.hadoop.fs.Path |
remoteDir |
private org.apache.hadoop.fs.Path |
rootDir |
private boolean |
showFiles |
private boolean |
showSchema |
private boolean |
showStats |
private SnapshotManifest |
snapshotManifest |
private String |
snapshotName |
cmdLineArgs, conf, EXIT_FAILURE, EXIT_SUCCESS, LONG_HELP_OPTION, options, SHORT_HELP_OPTION
Constructor and Description |
---|
SnapshotInfo() |
Modifier and Type | Method and Description |
---|---|
protected void |
addOptions()
Override this to add command-line options using
AbstractHBaseTool.addOptWithArg(java.lang.String, java.lang.String)
and similar methods. |
int |
doWork()
The "main function" of the tool
|
private String |
fileSizeToString(long size) |
private 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)
Gets the store files map for snapshot
|
static List<SnapshotDescription> |
getSnapshotList(org.apache.hadoop.conf.Configuration conf)
Returns the list of available snapshots in the specified location
|
static Map<org.apache.hadoop.fs.Path,Integer> |
getSnapshotsFilesMap(org.apache.hadoop.conf.Configuration conf,
AtomicLong uniqueHFilesArchiveSize,
AtomicLong uniqueHFilesSize,
AtomicLong uniqueHFilesMobSize)
Returns the map of store files based on path for all snapshots
|
static SnapshotInfo.SnapshotStats |
getSnapshotStats(org.apache.hadoop.conf.Configuration conf,
SnapshotDescription snapshot)
Returns the snapshot stats
|
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)
Returns the snapshot stats
|
private boolean |
loadSnapshotInfo(String snapshotName)
Load snapshot info and table descriptor for the specified snapshot
|
static void |
main(String[] args) |
private void |
printFiles(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 void |
printInfo()
Dump the
SnapshotDescription |
private void |
printSchema()
Dump the
TableDescriptor |
protected void |
printUsage() |
protected void |
processOptions(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd)
This method is called to process the options after they have been parsed.
|
addOption, addOptNoArg, addOptNoArg, addOptWithArg, addOptWithArg, addRequiredOption, addRequiredOptWithArg, addRequiredOptWithArg, doStaticMain, getConf, getOptionAsDouble, getOptionAsInt, getOptionAsLong, newParser, parseArgs, parseInt, parseLong, printUsage, processOldArgs, run, setConf
private static final org.slf4j.Logger LOG
private org.apache.hadoop.fs.FileSystem fs
private org.apache.hadoop.fs.Path rootDir
private SnapshotManifest snapshotManifest
private boolean listSnapshots
private String snapshotName
private org.apache.hadoop.fs.Path remoteDir
private boolean showSchema
private boolean showFiles
private boolean showStats
private boolean printSizeInBytes
public SnapshotInfo()
public int doWork() throws IOException, InterruptedException
AbstractHBaseTool
doWork
in class AbstractHBaseTool
IOException
InterruptedException
private boolean loadSnapshotInfo(String snapshotName) throws IOException
snapshotName
- name of the snapshot to loadIOException
private void printInfo()
SnapshotDescription
private void printSchema()
TableDescriptor
private void printFiles(boolean showFiles, boolean showStats) throws IOException
IOException
private String fileSizeToString(long size)
protected void addOptions()
AbstractHBaseTool
AbstractHBaseTool.addOptWithArg(java.lang.String, java.lang.String)
and similar methods.addOptions
in class AbstractHBaseTool
protected void processOptions(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine cmd)
AbstractHBaseTool
processOptions
in class AbstractHBaseTool
protected void printUsage()
printUsage
in class AbstractHBaseTool
public static SnapshotInfo.SnapshotStats getSnapshotStats(org.apache.hadoop.conf.Configuration conf, SnapshotDescription snapshot) throws IOException
conf
- the Configuration
to usesnapshot
- SnapshotDescription
to get stats fromIOException
public 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 IOException
conf
- the Configuration
to usesnapshotDesc
- HBaseProtos.SnapshotDescription to get stats fromfilesMap
- Map
store files map for all snapshots, it may be nullIOException
public static List<SnapshotDescription> getSnapshotList(org.apache.hadoop.conf.Configuration conf) throws IOException
conf
- the Configuration
to useIOException
private 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 IOException
conf
- the Configuration
to usesnapshot
- SnapshotDescription
to get stats fromexec
- the ExecutorService
to usefilesMap
- Map
the map to put the mapping entriesuniqueHFilesArchiveSize
- AtomicLong
the accumulated store file size in archiveuniqueHFilesSize
- AtomicLong
the accumulated store file size shareduniqueHFilesMobSize
- AtomicLong
the accumulated mob store file size sharedIOException
public static Map<org.apache.hadoop.fs.Path,Integer> getSnapshotsFilesMap(org.apache.hadoop.conf.Configuration conf, AtomicLong uniqueHFilesArchiveSize, AtomicLong uniqueHFilesSize, AtomicLong uniqueHFilesMobSize) throws IOException
conf
- the Configuration
to useuniqueHFilesArchiveSize
- pass out the size for store files in archiveuniqueHFilesSize
- pass out the size for store files shareduniqueHFilesMobSize
- pass out the size for mob store files sharedIOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.