@InterfaceAudience.Private public class CloneSnapshotHandler extends CreateTableHandler implements SnapshotSentinel
Uses RestoreSnapshotHelper
to create a new table with the same
content of the specified snapshot.
EventHandler.EventHandlerListener
conf, fileSystemManager, hTableDescriptor
eventType, seqids, server, waitingTimeForEvents
Constructor and Description |
---|
CloneSnapshotHandler(MasterServices masterServices,
org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription snapshot,
HTableDescriptor hTableDescriptor,
boolean restoreAcl) |
Modifier and Type | Method and Description |
---|---|
protected void |
addRegionsToMeta(List<HRegionInfo> regionInfos,
int regionReplication)
Add the specified set of regions to the hbase:meta table.
|
void |
cancel(String why)
Actively cancel a running snapshot.
|
protected void |
completed(Throwable exception)
Called after that process() is completed.
|
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 List<HRegionInfo> |
handleCreateHdfsRegions(org.apache.hadoop.fs.Path tableRootDir,
TableName tableName)
Create the on-disk regions, using the tableRootDir provided by the CreateTableHandler.
|
boolean |
isFinished()
Check to see if the snapshot is finished, where finished may be success or failure.
|
CloneSnapshotHandler |
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() . |
addReplicas, process, toString
compareTo, getEventType, getInformativeName, getListener, getPriority, getSeqid, handleException, run, setListener
public CloneSnapshotHandler(MasterServices masterServices, org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription snapshot, HTableDescriptor hTableDescriptor, boolean restoreAcl)
public CloneSnapshotHandler prepare() throws NotAllMetaRegionsOnlineException, TableExistsException, IOException
EventHandler
prepare
in class CreateTableHandler
NotAllMetaRegionsOnlineException
TableExistsException
IOException
protected List<HRegionInfo> handleCreateHdfsRegions(org.apache.hadoop.fs.Path tableRootDir, TableName tableName) throws IOException
handleCreateHdfsRegions
in class CreateTableHandler
tableRootDir
- directory where the table is being createdtableName
- name of the table under constructionIOException
protected void addRegionsToMeta(List<HRegionInfo> regionInfos, int regionReplication) throws IOException
CreateTableHandler
addRegionsToMeta
in class CreateTableHandler
IOException
protected void completed(Throwable exception)
CreateTableHandler
completed
in class CreateTableHandler
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.