@InterfaceAudience.Private public class RestoreSnapshotHandler extends TableEventHandler implements SnapshotSentinel
Uses RestoreSnapshotHelper
to replace the table content with the
data available in the snapshot.
EventHandler.EventHandlerListener
Modifier and Type | Field and Description |
---|---|
private HTableDescriptor |
hTableDescriptor |
private static org.apache.commons.logging.Log |
LOG |
private MetricsSnapshot |
metricsSnapshot |
private ForeignExceptionDispatcher |
monitor |
private org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription |
snapshot |
private MonitoredTask |
status |
private boolean |
stopped |
masterServices, tableLock, tableName
eventType, seqids, server, waitingTimeForEvents
Constructor and Description |
---|
RestoreSnapshotHandler(MasterServices masterServices,
org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription snapshot,
HTableDescriptor htd) |
Modifier and Type | Method and Description |
---|---|
void |
cancel(String why)
Actively cancel a running snapshot.
|
protected void |
completed(Throwable exception)
Called after that process() is completed.
|
private void |
forceRegionsOffline(List<HRegionInfo> hris) |
private void |
forceRegionsOffline(RestoreSnapshotHelper.RestoreMetaChanges metaChanges) |
long |
getCompletionTimestamp() |
ForeignException |
getExceptionIfFailed()
Get the exception that caused the snapshot to fail, if the snapshot has failed.
|
org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription |
getSnapshot() |
protected void |
handleTableOperation(List<HRegionInfo> hris)
The restore table is executed in place.
|
boolean |
isFinished()
Check to see if the snapshot is finished, where finished may be success or failure.
|
RestoreSnapshotHandler |
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 |
rethrowExceptionIfFailed()
Rethrow the exception returned by
SnapshotSentinel.getExceptionIfFailed() . |
getTableDescriptor, prepareWithTableLock, process, releaseTableLock, reOpenAllRegions
compareTo, getEventType, getInformativeName, getListener, getPriority, getSeqid, handleException, run, setListener, toString
private static final org.apache.commons.logging.Log LOG
private final HTableDescriptor hTableDescriptor
private final org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription snapshot
private final ForeignExceptionDispatcher monitor
private final MetricsSnapshot metricsSnapshot
private final MonitoredTask status
private volatile boolean stopped
public RestoreSnapshotHandler(MasterServices masterServices, org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription snapshot, HTableDescriptor htd) throws IOException
IOException
public RestoreSnapshotHandler prepare() throws IOException
EventHandler
prepare
in class TableEventHandler
IOException
protected void handleTableOperation(List<HRegionInfo> hris) throws IOException
handleTableOperation
in class TableEventHandler
IOException
private void forceRegionsOffline(RestoreSnapshotHelper.RestoreMetaChanges metaChanges)
private void forceRegionsOffline(List<HRegionInfo> hris)
protected void completed(Throwable exception)
TableEventHandler
completed
in class TableEventHandler
exception
- null if process() is successful or not null if something has failed.public boolean isFinished()
SnapshotSentinel
isFinished
in interface SnapshotSentinel
public long getCompletionTimestamp()
getCompletionTimestamp
in interface SnapshotSentinel
public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription getSnapshot()
getSnapshot
in interface SnapshotSentinel
public void cancel(String why)
SnapshotSentinel
cancel
in interface SnapshotSentinel
why
- Reason for cancellation.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 exceptionsCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.