org.apache.hadoop.hbase.snapshot
Class RestoreSnapshotHelper

java.lang.Object
  extended by org.apache.hadoop.hbase.snapshot.RestoreSnapshotHelper

@InterfaceAudience.Private
public class RestoreSnapshotHelper
extends Object

Helper to Restore/Clone a Snapshot

The helper assumes that a table is already created, and by calling restore() the content present in the snapshot will be restored as the new content of the table.

Clone from Snapshot: If the target table is empty, the restore operation is just a "clone operation", where the only operations are:

Restore from Snapshot:


Nested Class Summary
static class RestoreSnapshotHelper.RestoreMetaChanges
          Describe the set of operations needed to update META after restore.
 
Constructor Summary
RestoreSnapshotHelper(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, HBaseProtos.SnapshotDescription snapshotDescription, org.apache.hadoop.fs.Path snapshotDir, HTableDescriptor tableDescriptor, org.apache.hadoop.fs.Path tableDir, ForeignExceptionDispatcher monitor, MonitoredTask status)
           
 
Method Summary
 HRegionInfo cloneRegionInfo(HRegionInfo snapshotRegionInfo)
          Create a new HRegionInfo from the snapshot region info.
static HTableDescriptor cloneTableSchema(HTableDescriptor snapshotTableDescriptor, byte[] tableName)
          Create a new table descriptor cloning the snapshot table schema.
 RestoreSnapshotHelper.RestoreMetaChanges restoreHdfsRegions()
          Restore the on-disk table to a specified snapshot state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestoreSnapshotHelper

public RestoreSnapshotHelper(org.apache.hadoop.conf.Configuration conf,
                             org.apache.hadoop.fs.FileSystem fs,
                             HBaseProtos.SnapshotDescription snapshotDescription,
                             org.apache.hadoop.fs.Path snapshotDir,
                             HTableDescriptor tableDescriptor,
                             org.apache.hadoop.fs.Path tableDir,
                             ForeignExceptionDispatcher monitor,
                             MonitoredTask status)
Method Detail

restoreHdfsRegions

public RestoreSnapshotHelper.RestoreMetaChanges restoreHdfsRegions()
                                                            throws IOException
Restore the on-disk table to a specified snapshot state.

Returns:
the set of regions touched by the restore operation
Throws:
IOException

cloneRegionInfo

public HRegionInfo cloneRegionInfo(HRegionInfo snapshotRegionInfo)
Create a new HRegionInfo from the snapshot region info. Keep the same startKey, endKey, regionId and split information but change the table name.

Parameters:
snapshotRegionInfo - Info for region to clone.
Returns:
the new HRegion instance

cloneTableSchema

public static HTableDescriptor cloneTableSchema(HTableDescriptor snapshotTableDescriptor,
                                                byte[] tableName)
                                         throws IOException
Create a new table descriptor cloning the snapshot table schema.

Parameters:
snapshotTableDescriptor -
tableName -
Returns:
cloned table descriptor
Throws:
IOException


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