@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 String | HBASE_SNAPSHOT_ENABLEDEnable or disable snapshot support | 
| static String | HBASE_SNAPSHOT_SENTINELS_CLEANUP_TIMEOUT_MILLISWait time before removing a finished sentinel from the in-progress map
 NOTE: This is used as a safety auto cleanup. | 
| static String | ONLINE_SNAPSHOT_CONTROLLER_DESCRIPTIONName of the operation to use in the controller | 
| static int | SNAPSHOT_POOL_THREADS_DEFAULTnumber of current operations running on the master | 
| static String | SNAPSHOT_POOL_THREADS_KEYConf key for # of threads used by the SnapshotManager thread pool | 
| static long | SNAPSHOT_SENTINELS_CLEANUP_TIMEOUT_MILLS_DEFAULT | 
| Constructor and Description | 
|---|
| SnapshotManager() | 
| Modifier and Type | Method and Description | 
|---|---|
| void | checkSnapshotSupport()Throws an exception if snapshot operations (take a snapshot, restore, clone) are not supported. | 
| void | deleteSnapshot(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription snapshot)Delete the specified snapshot | 
| void | execProcedure(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ProcedureDescription desc)Execute a distributed procedure on cluster | 
| List<org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription> | getCompletedSnapshots()Gets the list of all completed snapshots. | 
| String | getProcedureSignature()Return the unique signature of the procedure. | 
| ReadWriteLock | getTakingSnapshotLock() | 
| void | initialize(MasterServices master,
          MetricsMaster metricsMaster)Initialize a globally barriered procedure for master. | 
| boolean | isProcedureDone(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ProcedureDescription desc)Check if the procedure is finished successfully | 
| boolean | isRestoreDone(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription snapshot)Returns the status of a restore operation. | 
| boolean | isSnapshotDone(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription expected)Check if the specified snapshot is done | 
| boolean | isStopped() | 
| boolean | isTakingAnySnapshot()The snapshot operation processing as following:  1. | 
| void | restoreSnapshot(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription reqSnapshot)Deprecated.  | 
| void | restoreSnapshot(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription reqSnapshot,
               boolean restoreAcl)Restore the specified snapshot | 
| void | setSnapshotHandlerForTesting(TableName tableName,
                            SnapshotSentinel handler)Set the handler for the current snapshot | 
| void | stop(String why)Stop this service. | 
| void | takeSnapshot(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription snapshot)Take a snapshot based on the enabled/disabled state of the table. | 
execProcedureWithRetequals, hashCodepublic static final String HBASE_SNAPSHOT_SENTINELS_CLEANUP_TIMEOUT_MILLIS
public static final long SNAPSHOT_SENTINELS_CLEANUP_TIMEOUT_MILLS_DEFAULT
public static final String HBASE_SNAPSHOT_ENABLED
public static final String ONLINE_SNAPSHOT_CONTROLLER_DESCRIPTION
public static final String SNAPSHOT_POOL_THREADS_KEY
public static final int SNAPSHOT_POOL_THREADS_DEFAULT
public List<org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription> getCompletedSnapshots() throws IOException
IOException - File system exceptionpublic void deleteSnapshot(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription snapshot)
                    throws IOException
snapshot - SnapshotDoesNotExistException - If the specified snapshot does not exist.IOException - For filesystem IOExceptionspublic boolean isSnapshotDone(org.apache.hadoop.hbase.protobuf.generated.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(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription snapshot)
                  throws IOException
snapshot - HBaseSnapshotException - when a snapshot specific exception occurs.IOException - when some sort of generic IO exception occurs.public ReadWriteLock getTakingSnapshotLock()
public boolean isTakingAnySnapshot()
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.@Deprecated public void restoreSnapshot(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription reqSnapshot) throws IOException
reqSnapshot - the snapshot to restoreIOExceptionpublic void restoreSnapshot(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription reqSnapshot,
                   boolean restoreAcl)
                     throws IOException
reqSnapshot - the snapshot to restorerestoreAcl - whether or not to restore ACLs on the snapshotIOExceptionpublic boolean isRestoreDone(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription snapshot)
                      throws IOException
snapshot - IOException - if there was a failure during the restorepublic void stop(String why)
Stoppablepublic boolean isStopped()
isStopped in interface StoppableStoppable.stop(String) has been closed.public void checkSnapshotSupport()
                          throws UnsupportedOperationException
UnsupportedOperationException - if snapshot are not supportedpublic void initialize(MasterServices master, MetricsMaster metricsMaster) throws org.apache.zookeeper.KeeperException, IOException, UnsupportedOperationException
MasterProcedureManagerinitialize in class MasterProcedureManagermaster - Master service interfaceorg.apache.zookeeper.KeeperExceptionIOExceptionUnsupportedOperationExceptionpublic String getProcedureSignature()
ProcedureManagergetProcedureSignature in class ProcedureManagerpublic void execProcedure(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ProcedureDescription desc)
                   throws IOException
MasterProcedureManagerexecProcedure in class MasterProcedureManagerdesc - Procedure descriptionIOExceptionpublic boolean isProcedureDone(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ProcedureDescription desc)
                        throws IOException
MasterProcedureManagerisProcedureDone in class MasterProcedureManagerdesc - Procedure descriptionIOExceptionCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.