@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 long |
SNAPSHOT_SENTINELS_CLEANUP_TIMEOUT_MILLS_DEFAULT |
Constructor and Description |
---|
SnapshotManager() |
execProcedureWithRet
equals, hashCode
public 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 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
snapshot
- 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
expected
- 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 ReadWriteLock getTakingSnapshotLock()
public boolean isTakingAnySnapshot()
public void takeSnapshot(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.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 long restoreOrCloneSnapshot(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription reqSnapshot, NonceKey nonceKey, boolean restoreAcl) throws IOException
reqSnapshot
- nonceKey
- unique identifier to prevent duplicated RPCIOException
public void checkSnapshotSupport() throws UnsupportedOperationException
UnsupportedOperationException
- if snapshot are not supportedpublic void initialize(MasterServices master, MetricsMaster metricsMaster) throws org.apache.zookeeper.KeeperException, IOException, UnsupportedOperationException
MasterProcedureManager
initialize
in class MasterProcedureManager
master
- Master service interfaceorg.apache.zookeeper.KeeperException
IOException
UnsupportedOperationException
public String getProcedureSignature()
ProcedureManager
getProcedureSignature
in class ProcedureManager
public void execProcedure(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription desc) throws IOException
MasterProcedureManager
execProcedure
in class MasterProcedureManager
desc
- Procedure descriptionIOException
public void checkPermissions(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription desc, AccessChecker accessChecker, User user) throws IOException
MasterProcedureManager
checkPermissions
in class MasterProcedureManager
IOException
- if permissions requirements are not met.public boolean isProcedureDone(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription desc) throws IOException
MasterProcedureManager
isProcedureDone
in class MasterProcedureManager
desc
- Procedure descriptionIOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.