@InterfaceAudience.LimitedPrivate(value="Configuration") @InterfaceStability.Unstable public class SnapshotManager extends MasterProcedureManager 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 java.lang.String |
HBASE_SNAPSHOT_ENABLED
Enable or disable snapshot support
|
static java.lang.String |
ONLINE_SNAPSHOT_CONTROLLER_DESCRIPTION
Name of the operation to use in the controller
|
| Constructor and Description |
|---|
SnapshotManager() |
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
|
void |
execProcedure(HBaseProtos.ProcedureDescription desc)
Execute a distributed procedure on cluster
|
java.util.List<HBaseProtos.SnapshotDescription> |
getCompletedSnapshots()
Gets the list of all completed snapshots.
|
java.lang.String |
getProcedureSignature()
Return the unique signature of the procedure.
|
void |
initialize(MasterServices master,
MetricsMaster metricsMaster)
Initialize a globally barriered procedure for master.
|
boolean |
isProcedureDone(HBaseProtos.ProcedureDescription desc)
Check if the procedure is finished successfully
|
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,
boolean restoreAcl)
Restore the specified snapshot
|
void |
setSnapshotHandlerForTesting(TableName tableName,
SnapshotSentinel handler)
Set the handler for the current snapshot
|
void |
stop(java.lang.String why)
Stop this service.
|
void |
takeSnapshot(HBaseProtos.SnapshotDescription snapshot)
Take a snapshot based on the enabled/disabled state of the table.
|
execProcedureWithRetequals, hashCodepublic static final java.lang.String HBASE_SNAPSHOT_ENABLED
public static final java.lang.String ONLINE_SNAPSHOT_CONTROLLER_DESCRIPTION
public SnapshotManager()
public SnapshotManager(MasterServices master, MetricsMaster metricsMaster, ProcedureCoordinator coordinator, ExecutorService pool) throws java.io.IOException, java.lang.UnsupportedOperationException
master - services for the master where the manager is runningcoordinator - procedure coordinator instance. exposed for testing.pool - HBase ExecutorServcie instance, exposed for testing.java.io.IOExceptionjava.lang.UnsupportedOperationExceptionpublic java.util.List<HBaseProtos.SnapshotDescription> getCompletedSnapshots() throws java.io.IOException
java.io.IOException - File system exceptionpublic void deleteSnapshot(HBaseProtos.SnapshotDescription snapshot) throws SnapshotDoesNotExistException, java.io.IOException
snapshot - SnapshotDoesNotExistException - If the specified snapshot does not exist.java.io.IOException - For filesystem IOExceptionspublic boolean isSnapshotDone(HBaseProtos.SnapshotDescription expected) throws java.io.IOException
expected - java.io.IOException - IOException if error from HDFS or RPCUnknownSnapshotException - if snapshot is invalid or does not exist.public void takeSnapshot(HBaseProtos.SnapshotDescription snapshot) throws java.io.IOException
snapshot - HBaseSnapshotException - when a snapshot specific exception occurs.java.io.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, boolean restoreAcl) throws java.io.IOException
reqSnapshot - java.io.IOExceptionpublic boolean isRestoreDone(HBaseProtos.SnapshotDescription snapshot) throws java.io.IOException
snapshot - java.io.IOException - if there was a failure during the restorepublic void stop(java.lang.String why)
Stoppablepublic boolean isStopped()
isStopped in interface StoppableStoppable.stop(String) has been closed.public void checkSnapshotSupport()
throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException - if snapshot are not supportedpublic void initialize(MasterServices master, MetricsMaster metricsMaster) throws KeeperException, java.io.IOException, java.lang.UnsupportedOperationException
MasterProcedureManagerinitialize in class MasterProcedureManagermaster - Master service interfaceKeeperExceptionjava.io.IOExceptionjava.lang.UnsupportedOperationExceptionpublic java.lang.String getProcedureSignature()
ProcedureManagergetProcedureSignature in class ProcedureManagerpublic void execProcedure(HBaseProtos.ProcedureDescription desc) throws java.io.IOException
MasterProcedureManagerexecProcedure in class MasterProcedureManagerdesc - Procedure descriptionjava.io.IOExceptionpublic boolean isProcedureDone(HBaseProtos.ProcedureDescription desc) throws java.io.IOException
MasterProcedureManagerisProcedureDone in class MasterProcedureManagerdesc - Procedure descriptionjava.io.IOException