@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_ENABLED
Enable or disable snapshot support
|
static String |
HBASE_SNAPSHOT_SENTINELS_CLEANUP_TIMEOUT_MILLIS
Wait 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_DESCRIPTION
Name of the operation to use in the controller
|
static String |
SNAPSHOT_MAX_FILE_SIZE_PRESERVE
Conf key for preserving original max file size configs
|
static int |
SNAPSHOT_POOL_THREADS_DEFAULT
number of current operations running on the master
|
static String |
SNAPSHOT_POOL_THREADS_KEY
Conf key for # of threads used by the SnapshotManager thread pool
|
static String |
SNAPSHOT_PROCEDURE_ENABLED
Enable or disable snapshot procedure
|
static boolean |
SNAPSHOT_PROCEDURE_ENABLED_DEFAULT |
static long |
SNAPSHOT_SENTINELS_CLEANUP_TIMEOUT_MILLS_DEFAULT |
| Constructor and Description |
|---|
SnapshotManager() |
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 static final String SNAPSHOT_MAX_FILE_SIZE_PRESERVE
public static final String SNAPSHOT_PROCEDURE_ENABLED
public static final boolean SNAPSHOT_PROCEDURE_ENABLED_DEFAULT
public List<org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription> getCompletedSnapshots() throws IOException
IOException - File system exceptionpublic void deleteSnapshot(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot) throws IOException
SnapshotDoesNotExistException - If the specified snapshot does not exist.IOException - For filesystem IOExceptionspublic boolean isSnapshotDone(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription expected) throws IOException
IOException - IOException if error from HDFS or RPCUnknownSnapshotException - if snapshot is invalid or does not exist.public boolean isTakingSnapshot(TableName tableName)
tableName - name of the table being snapshotted.public boolean isTableTakingAnySnapshot(TableName tableName)
public void prepareWorkingDirectory(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot) throws HBaseSnapshotException
snapshot - description of the snapshot we want to startHBaseSnapshotException - if the filesystem could not be prepared to start the snapshotpublic ReadWriteLock getTakingSnapshotLock()
public boolean isTakingAnySnapshot()
public void takeSnapshot(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot) throws IOException
HBaseSnapshotException - when a snapshot specific exception occurs.IOException - when some sort of generic IO exception occurs.public long takeSnapshot(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot, long nonceGroup, long nonce) throws IOException
IOExceptionpublic void setSnapshotHandlerForTesting(TableName tableName, SnapshotSentinel handler)
Exposed for TESTING
handler - handler the master should use TODO get rid of this if possible, repackaging,
modify tests.public long restoreOrCloneSnapshot(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription reqSnapshot, NonceKey nonceKey, boolean restoreAcl, String customSFT) throws IOException
nonceKey - unique identifier to prevent duplicated RPCIOExceptionpublic 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.shaded.protobuf.generated.HBaseProtos.ProcedureDescription desc) throws IOException
MasterProcedureManagerexecProcedure in class MasterProcedureManagerdesc - Procedure descriptionIOExceptionpublic void checkPermissions(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription desc, AccessChecker accessChecker, User user) throws IOException
MasterProcedureManagercheckPermissions in class MasterProcedureManagerIOException - if permissions requirements are not met.public boolean isProcedureDone(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription desc) throws IOException
MasterProcedureManagerisProcedureDone in class MasterProcedureManagerdesc - Procedure descriptionIOExceptionpublic void registerSnapshotProcedure(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot, long procId)
public void unregisterSnapshotProcedure(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot, long procId)
public boolean snapshotProcedureEnabled()
public ServerName acquireSnapshotVerifyWorker(SnapshotVerifyProcedure procedure) throws ProcedureSuspendedException
ProcedureSuspendedExceptionpublic void releaseSnapshotVerifyWorker(SnapshotVerifyProcedure procedure, ServerName worker, MasterProcedureScheduler scheduler)
public Integer getAvailableWorker(ServerName serverName)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.