@InterfaceAudience.Private public abstract class TakeSnapshotHandler extends EventHandler implements SnapshotSentinel, ForeignExceptionSnare
snapshotRegions(List)
call
should get implemented for each snapshot flavor.Modifier and Type | Field and Description |
---|---|
protected org.apache.hadoop.conf.Configuration |
conf |
private boolean |
finished |
protected TableDescriptor |
htd |
private static org.slf4j.Logger |
LOG |
protected MasterServices |
master |
protected MetricsSnapshot |
metricsSnapshot |
protected ForeignExceptionDispatcher |
monitor |
protected org.apache.hadoop.fs.Path |
rootDir |
protected org.apache.hadoop.fs.FileSystem |
rootFs |
protected org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription |
snapshot |
private org.apache.hadoop.fs.Path |
snapshotDir |
protected SnapshotManager |
snapshotManager |
protected SnapshotManifest |
snapshotManifest |
protected TableName |
snapshotTable |
protected MonitoredTask |
status |
private LockManager.MasterLock |
tableLock |
private MasterSnapshotVerifier |
verifier |
protected org.apache.hadoop.fs.Path |
workingDir |
protected org.apache.hadoop.fs.FileSystem |
workingDirFs |
eventType, seqids, server, waitingTimeForEvents
Constructor and Description |
---|
TakeSnapshotHandler(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot,
MasterServices masterServices,
SnapshotManager snapshotManager) |
Modifier and Type | Method and Description |
---|---|
void |
cancel(String why)
Actively cancel a running snapshot.
|
protected abstract boolean |
downgradeToSharedTableLock()
When taking snapshot, first we must acquire the exclusive table lock to confirm that there are
no ongoing merge/split procedures.
|
long |
getCompletionTimestamp()
Returns -1 if the snapshot is in progress, otherwise the completion timestamp.
|
ForeignException |
getException()
Get the value of the captured exception.
|
ForeignException |
getExceptionIfFailed()
Get the exception that caused the snapshot to fail, if the snapshot has failed.
|
org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription |
getSnapshot()
Returns the description of the snapshot being run
|
boolean |
hasException()
Non-exceptional form of
ForeignExceptionSnare.rethrowException() . |
boolean |
isFinished()
Check to see if the snapshot is finished, where finished may be success or failure.
|
private TableDescriptor |
loadTableDescriptor() |
TakeSnapshotHandler |
prepare()
Event handlers should do all the necessary checks in this method (rather than in the
constructor, or in process()) so that the caller, which is mostly executed in the ipc context
can fail fast.
|
void |
process()
Execute the core common portions of taking a snapshot.
|
void |
rethrowException()
Rethrow an exception currently held by the
ForeignExceptionSnare . |
void |
rethrowExceptionIfFailed()
Rethrow the exception returned by
SnapshotSentinel.getExceptionIfFailed() . |
protected void |
snapshotDisabledRegion(RegionInfo regionInfo)
Take a snapshot of the specified disabled region
|
protected abstract void |
snapshotRegions(List<Pair<RegionInfo,ServerName>> regions)
Snapshot the specified regions
|
compareTo, getEventType, getInformativeName, getPriority, getSeqid, handleException, run, toString
private static final org.slf4j.Logger LOG
private volatile boolean finished
protected final MasterServices master
protected final MetricsSnapshot metricsSnapshot
protected final org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot
protected final org.apache.hadoop.conf.Configuration conf
protected final org.apache.hadoop.fs.FileSystem rootFs
protected final org.apache.hadoop.fs.FileSystem workingDirFs
protected final org.apache.hadoop.fs.Path rootDir
private final org.apache.hadoop.fs.Path snapshotDir
protected final org.apache.hadoop.fs.Path workingDir
private final MasterSnapshotVerifier verifier
protected final ForeignExceptionDispatcher monitor
private final LockManager.MasterLock tableLock
protected final MonitoredTask status
protected final TableName snapshotTable
protected final SnapshotManifest snapshotManifest
protected final SnapshotManager snapshotManager
protected TableDescriptor htd
public TakeSnapshotHandler(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot, MasterServices masterServices, SnapshotManager snapshotManager) throws IOException
snapshot
- descriptor of the snapshot to takemasterServices
- master services providerIllegalArgumentException
- if the working snapshot directory set from the configuration
is the same as the completed snapshot directoryIOException
- if the file system of the working snapshot directory cannot be
determinedprivate TableDescriptor loadTableDescriptor() throws IOException
IOException
public TakeSnapshotHandler prepare() throws Exception
EventHandler
prepare
in class EventHandler
Exception
- when something goes wrongpublic void process()
snapshotRegions(List)
call
should get implemented for each snapshot flavor.process
in class EventHandler
protected abstract boolean downgradeToSharedTableLock()
protected abstract void snapshotRegions(List<Pair<RegionInfo,ServerName>> regions) throws IOException, org.apache.zookeeper.KeeperException
IOException
org.apache.zookeeper.KeeperException
protected void snapshotDisabledRegion(RegionInfo regionInfo) throws IOException
IOException
public void cancel(String why)
SnapshotSentinel
cancel
in interface SnapshotSentinel
why
- Reason for cancellation.public boolean isFinished()
SnapshotSentinel
isFinished
in interface SnapshotSentinel
public long getCompletionTimestamp()
SnapshotSentinel
getCompletionTimestamp
in interface SnapshotSentinel
public org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription getSnapshot()
SnapshotSentinel
getSnapshot
in interface SnapshotSentinel
public ForeignException getExceptionIfFailed()
SnapshotSentinel
getExceptionIfFailed
in interface SnapshotSentinel
ForeignException
that caused the snapshot to fail, or null if the
snapshot is still in progress or has succeededpublic void rethrowExceptionIfFailed() throws ForeignException
SnapshotSentinel
SnapshotSentinel.getExceptionIfFailed()
. If there is no
exception this is a no-op.rethrowExceptionIfFailed
in interface SnapshotSentinel
ForeignException
- all exceptions from remote sources are procedure exceptionspublic void rethrowException() throws ForeignException
ForeignExceptionSnare
ForeignExceptionSnare
. If there is no
exception this is a no-op n * all exceptions from remote sources are procedure exceptionsrethrowException
in interface ForeignExceptionSnare
ForeignException
public boolean hasException()
ForeignExceptionSnare
ForeignExceptionSnare.rethrowException()
. Checks to see if any process to which the
exception checkers is bound has created an error that would cause a failure.hasException
in interface ForeignExceptionSnare
public ForeignException getException()
ForeignExceptionSnare
getException
in interface ForeignExceptionSnare
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.