@InterfaceAudience.Private @InterfaceStability.Unstable public class SnapshotManager extends Object implements Stoppable
The class provides methods for monitoring in-progress snapshot actions.
Note: Currently there can only be one snapshot being taken at a time over the cluster. This is a simplification in the current implementation.
| Modifier and Type | Field and Description |
|---|---|
static String |
HBASE_SNAPSHOT_ENABLED
Enable or disable snapshot support
|
static String |
ONLINE_SNAPSHOT_CONTROLLER_DESCRIPTION
Name of the operation to use in the controller
|
| Constructor and Description |
|---|
SnapshotManager(MasterServices master,
MetricsMaster metricsMaster)
Construct a snapshot manager.
|
SnapshotManager(MasterServices master,
MetricsMaster metricsMaster,
ProcedureCoordinator coordinator,
ExecutorService pool)
Fully specify all necessary components of a snapshot manager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkSnapshotSupport()
Throws an exception if snapshot operations (take a snapshot, restore, clone) are not supported.
|
void |
deleteSnapshot(HBaseProtos.SnapshotDescription snapshot)
Delete the specified snapshot
|
List<HBaseProtos.SnapshotDescription> |
getCompletedSnapshots()
Gets the list of all completed snapshots.
|
boolean |
isRestoreDone(HBaseProtos.SnapshotDescription snapshot)
Returns the status of a restore operation.
|
boolean |
isSnapshotDone(HBaseProtos.SnapshotDescription expected)
Check if the specified snapshot is done
|
boolean |
isStopped() |
void |
restoreSnapshot(HBaseProtos.SnapshotDescription reqSnapshot)
Restore the specified snapshot
|
void |
setSnapshotHandlerForTesting(TableName tableName,
SnapshotSentinel handler)
Set the handler for the current snapshot
|
void |
stop(String why) |
void |
takeSnapshot(HBaseProtos.SnapshotDescription snapshot)
Take a snapshot based on the enabled/disabled state of the table.
|
public static final String HBASE_SNAPSHOT_ENABLED
public static final String ONLINE_SNAPSHOT_CONTROLLER_DESCRIPTION
public SnapshotManager(MasterServices master, MetricsMaster metricsMaster) throws org.apache.zookeeper.KeeperException, IOException, UnsupportedOperationException
master - org.apache.zookeeper.KeeperExceptionIOExceptionUnsupportedOperationExceptionpublic SnapshotManager(MasterServices master, MetricsMaster metricsMaster, ProcedureCoordinator coordinator, ExecutorService pool) throws IOException, UnsupportedOperationException
master - services for the master where the manager is runningcoordinator - procedure coordinator instance. exposed for testing.pool - HBase ExecutorServcie instance, exposed for testing.IOExceptionUnsupportedOperationExceptionpublic List<HBaseProtos.SnapshotDescription> getCompletedSnapshots() throws IOException
IOException - File system exceptionpublic void deleteSnapshot(HBaseProtos.SnapshotDescription snapshot) throws SnapshotDoesNotExistException, IOException
snapshot - SnapshotDoesNotExistException - If the specified snapshot does not exist.IOException - For filesystem IOExceptionspublic boolean isSnapshotDone(HBaseProtos.SnapshotDescription expected) throws IOException
expected - IOException - IOException if error from HDFS or RPCUnknownSnapshotException - if snapshot is invalid or does not exist.public void takeSnapshot(HBaseProtos.SnapshotDescription snapshot) throws IOException
snapshot - HBaseSnapshotException - when a snapshot specific exception occurs.IOException - when some sort of generic IO exception occurs.public void setSnapshotHandlerForTesting(TableName tableName, SnapshotSentinel handler)
Exposed for TESTING
tableName - handler - handler the master should use
TODO get rid of this if possible, repackaging, modify tests.public void restoreSnapshot(HBaseProtos.SnapshotDescription reqSnapshot) throws IOException
reqSnapshot - IOExceptionpublic boolean isRestoreDone(HBaseProtos.SnapshotDescription snapshot) throws IOException
snapshot - IOException - if there was a failure during the restorepublic void checkSnapshotSupport()
throws UnsupportedOperationException
UnsupportedOperationException - if snapshot are not supportedCopyright © 2014 The Apache Software Foundation. All Rights Reserved.