org.apache.hadoop.hbase.master.snapshot
Class RestoreSnapshotHandler

java.lang.Object
  extended by org.apache.hadoop.hbase.executor.EventHandler
      extended by org.apache.hadoop.hbase.master.handler.TableEventHandler
          extended by org.apache.hadoop.hbase.master.snapshot.RestoreSnapshotHandler
All Implemented Interfaces:
Comparable<Runnable>, Runnable, SnapshotSentinel

@InterfaceAudience.Private
public class RestoreSnapshotHandler
extends TableEventHandler
implements SnapshotSentinel

Handler to Restore a snapshot.

Uses RestoreSnapshotHelper to replace the table content with the data available in the snapshot.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.executor.EventHandler
EventHandler.EventHandlerListener
 
Field Summary
 
Fields inherited from class org.apache.hadoop.hbase.master.handler.TableEventHandler
masterServices, tableLock, tableName, tableNameStr
 
Fields inherited from class org.apache.hadoop.hbase.executor.EventHandler
eventType, seqids, server, waitingTimeForEvents
 
Constructor Summary
RestoreSnapshotHandler(MasterServices masterServices, HBaseProtos.SnapshotDescription snapshot, HTableDescriptor htd)
           
 
Method Summary
 void cancel(String why)
          Actively cancel a running snapshot.
 ForeignException getExceptionIfFailed()
          Get the exception that caused the snapshot to fail, if the snapshot has failed.
 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.
 
Methods inherited from class org.apache.hadoop.hbase.master.handler.TableEventHandler
getTableDescriptor, prepare, prepareWithTableLock, process, releaseTableLock, reOpenAllRegions
 
Methods inherited from class org.apache.hadoop.hbase.executor.EventHandler
compareTo, getEventType, getInformativeName, getListener, getPriority, getSeqid, run, setListener, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RestoreSnapshotHandler

public RestoreSnapshotHandler(MasterServices masterServices,
                              HBaseProtos.SnapshotDescription snapshot,
                              HTableDescriptor htd)
                       throws IOException
Throws:
IOException
Method Detail

handleTableOperation

protected void handleTableOperation(List<HRegionInfo> hris)
                             throws IOException
The restore table is executed in place. - The on-disk data will be restored - reference files are put in place without moving data - [if something fail here: you need to delete the table and re-run the restore] - META will be updated - [if something fail here: you need to run hbck to fix META entries] The passed in list gets changed in this method

Specified by:
handleTableOperation in class TableEventHandler
Throws:
IOException

isFinished

public boolean isFinished()
Description copied from interface: SnapshotSentinel
Check to see if the snapshot is finished, where finished may be success or failure.

Specified by:
isFinished in interface SnapshotSentinel
Returns:
false if the snapshot is still in progress, true if the snapshot has finished

getSnapshot

public HBaseProtos.SnapshotDescription getSnapshot()
Specified by:
getSnapshot in interface SnapshotSentinel
Returns:
the description of the snapshot being run

cancel

public void cancel(String why)
Description copied from interface: SnapshotSentinel
Actively cancel a running snapshot.

Specified by:
cancel in interface SnapshotSentinel
Parameters:
why - Reason for cancellation.

getExceptionIfFailed

public ForeignException getExceptionIfFailed()
Description copied from interface: SnapshotSentinel
Get the exception that caused the snapshot to fail, if the snapshot has failed.

Specified by:
getExceptionIfFailed in interface SnapshotSentinel
Returns:
ForeignException that caused the snapshot to fail, or null if the snapshot is still in progress or has succeeded


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.