public class SnapshotManager
extends MasterProcedureManager
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 |
checkPermissions(ProcedureDescription desc,
AccessChecker accessChecker,
User user) |
void |
checkSnapshotSupport()
Throws an exception if snapshot operations (take a snapshot, restore, clone) are not supported.
|
void |
deleteSnapshot(SnapshotDescription snapshot)
Delete the specified snapshot
|
void |
execProcedure(ProcedureDescription desc) |
java.util.List<SnapshotDescription> |
getCompletedSnapshots()
Gets the list of all completed snapshots.
|
<any> |
getLocks() |
java.lang.String |
getProcedureSignature() |
void |
initialize(MasterServices master,
MetricsMaster metricsMaster) |
boolean |
isProcedureDone(ProcedureDescription desc) |
boolean |
isSnapshotDone(SnapshotDescription expected)
Check if the specified snapshot is done
|
boolean |
isStopped() |
long |
restoreOrCloneSnapshot(SnapshotDescription reqSnapshot,
NonceKey nonceKey,
boolean restoreAcl)
Restore or Clone the specified snapshot
|
void |
setSnapshotHandlerForTesting(TableName tableName,
SnapshotSentinel handler)
Set the handler for the current snapshot
|
void |
stop(java.lang.String why) |
void |
takeSnapshot(SnapshotDescription snapshot)
Take a snapshot based on the enabled/disabled state of the table.
|
public 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<SnapshotDescription> getCompletedSnapshots()
throws java.io.IOException
java.io.IOException - File system exceptionpublic void deleteSnapshot(SnapshotDescription snapshot)
throws SnapshotDoesNotExistException,
java.io.IOException
snapshot - SnapshotDoesNotExistException - If the specified snapshot does not exist.java.io.IOException - For filesystem IOExceptionspublic boolean isSnapshotDone(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(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 long restoreOrCloneSnapshot(SnapshotDescription reqSnapshot,
NonceKey nonceKey,
boolean restoreAcl)
throws java.io.IOException
reqSnapshot - nonceKey - unique identifier to prevent duplicated RPCjava.io.IOExceptionpublic void stop(java.lang.String why)
public boolean isStopped()
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
KeeperExceptionjava.io.IOExceptionjava.lang.UnsupportedOperationExceptionpublic java.lang.String getProcedureSignature()
public void execProcedure(ProcedureDescription desc)
throws java.io.IOException
java.io.IOExceptionpublic void checkPermissions(ProcedureDescription desc,
AccessChecker accessChecker,
User user)
throws java.io.IOException
java.io.IOExceptionpublic boolean isProcedureDone(ProcedureDescription desc)
throws java.io.IOException
java.io.IOExceptionpublic <any> getLocks()