org.apache.hadoop.hbase.snapshot
Class SnapshotReferenceUtil

java.lang.Object
  extended by org.apache.hadoop.hbase.snapshot.SnapshotReferenceUtil

@InterfaceAudience.Private
public final class SnapshotReferenceUtil
extends Object

Utility methods for interacting with the snapshot referenced files.


Nested Class Summary
static interface SnapshotReferenceUtil.SnapshotVisitor
           
static interface SnapshotReferenceUtil.StoreFileVisitor
           
 
Field Summary
static org.apache.commons.logging.Log LOG
           
 
Method Summary
static void concurrentVisitReferencedFiles(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, SnapshotManifest manifest, SnapshotReferenceUtil.StoreFileVisitor visitor)
           
static Set<String> getHFileNames(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path snapshotDir)
          Returns the store file names in the snapshot.
static Set<String> getHLogNames(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path snapshotDir)
          Returns the log file names available in the snapshot.
static org.apache.hadoop.fs.Path getLogsDir(org.apache.hadoop.fs.Path snapshotDir, String serverName)
          Get log directory for a server in a snapshot.
static void verifySnapshot(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path snapshotDir, HBaseProtos.SnapshotDescription snapshotDesc)
          Verify the validity of the snapshot
static void verifySnapshot(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, SnapshotManifest manifest)
          Verify the validity of the snapshot
static void visitLogFiles(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path snapshotDir, FSVisitor.LogFileVisitor visitor)
          Iterate over the snapshot log files
static void visitReferencedFiles(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path snapshotDir, HBaseProtos.SnapshotDescription desc, SnapshotReferenceUtil.SnapshotVisitor visitor)
          Iterate over the snapshot store files, restored.edits and logs
static void visitReferencedFiles(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path snapshotDir, SnapshotReferenceUtil.SnapshotVisitor visitor)
          Iterate over the snapshot store files, restored.edits and logs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
Method Detail

getLogsDir

public static org.apache.hadoop.fs.Path getLogsDir(org.apache.hadoop.fs.Path snapshotDir,
                                                   String serverName)
Get log directory for a server in a snapshot.

Parameters:
snapshotDir - directory where the specific snapshot is stored
serverName - name of the parent regionserver for the log files
Returns:
path to the log home directory for the archive files.

visitReferencedFiles

public static void visitReferencedFiles(org.apache.hadoop.conf.Configuration conf,
                                        org.apache.hadoop.fs.FileSystem fs,
                                        org.apache.hadoop.fs.Path snapshotDir,
                                        SnapshotReferenceUtil.SnapshotVisitor visitor)
                                 throws IOException
Iterate over the snapshot store files, restored.edits and logs

Parameters:
conf - The current Configuration instance.
fs - FileSystem
snapshotDir - Path to the Snapshot directory
visitor - callback object to get the referenced files
Throws:
IOException - if an error occurred while scanning the directory

visitReferencedFiles

public static void visitReferencedFiles(org.apache.hadoop.conf.Configuration conf,
                                        org.apache.hadoop.fs.FileSystem fs,
                                        org.apache.hadoop.fs.Path snapshotDir,
                                        HBaseProtos.SnapshotDescription desc,
                                        SnapshotReferenceUtil.SnapshotVisitor visitor)
                                 throws IOException
Iterate over the snapshot store files, restored.edits and logs

Parameters:
conf - The current Configuration instance.
fs - FileSystem
snapshotDir - Path to the Snapshot directory
desc - the HBaseProtos.SnapshotDescription of the snapshot to verify
visitor - callback object to get the referenced files
Throws:
IOException - if an error occurred while scanning the directory

visitLogFiles

public static void visitLogFiles(org.apache.hadoop.fs.FileSystem fs,
                                 org.apache.hadoop.fs.Path snapshotDir,
                                 FSVisitor.LogFileVisitor visitor)
                          throws IOException
Iterate over the snapshot log files

Parameters:
fs - FileSystem
snapshotDir - Path to the Snapshot directory
visitor - callback object to get the log files
Throws:
IOException - if an error occurred while scanning the directory

verifySnapshot

public static void verifySnapshot(org.apache.hadoop.conf.Configuration conf,
                                  org.apache.hadoop.fs.FileSystem fs,
                                  org.apache.hadoop.fs.Path snapshotDir,
                                  HBaseProtos.SnapshotDescription snapshotDesc)
                           throws IOException
Verify the validity of the snapshot

Parameters:
conf - The current Configuration instance.
fs - FileSystem
snapshotDir - Path to the Snapshot directory of the snapshot to verify
snapshotDesc - the HBaseProtos.SnapshotDescription of the snapshot to verify
Throws:
CorruptedSnapshotException - if the snapshot is corrupted
IOException - if an error occurred while scanning the directory

verifySnapshot

public static void verifySnapshot(org.apache.hadoop.conf.Configuration conf,
                                  org.apache.hadoop.fs.FileSystem fs,
                                  SnapshotManifest manifest)
                           throws IOException
Verify the validity of the snapshot

Parameters:
conf - The current Configuration instance.
fs - FileSystem
manifest - snapshot manifest to inspect
Throws:
CorruptedSnapshotException - if the snapshot is corrupted
IOException - if an error occurred while scanning the directory

concurrentVisitReferencedFiles

public static void concurrentVisitReferencedFiles(org.apache.hadoop.conf.Configuration conf,
                                                  org.apache.hadoop.fs.FileSystem fs,
                                                  SnapshotManifest manifest,
                                                  SnapshotReferenceUtil.StoreFileVisitor visitor)
                                           throws IOException
Throws:
IOException

getHFileNames

public static Set<String> getHFileNames(org.apache.hadoop.conf.Configuration conf,
                                        org.apache.hadoop.fs.FileSystem fs,
                                        org.apache.hadoop.fs.Path snapshotDir)
                                 throws IOException
Returns the store file names in the snapshot.

Parameters:
conf - The current Configuration instance.
fs - FileSystem
snapshotDir - Path to the Snapshot directory
Returns:
the names of hfiles in the specified snaphot
Throws:
IOException - if an error occurred while scanning the directory

getHLogNames

public static Set<String> getHLogNames(org.apache.hadoop.fs.FileSystem fs,
                                       org.apache.hadoop.fs.Path snapshotDir)
                                throws IOException
Returns the log file names available in the snapshot.

Parameters:
fs - FileSystem
snapshotDir - Path to the Snapshot directory
Returns:
the names of hlogs in the specified snaphot
Throws:
IOException - if an error occurred while scanning the directory


Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.