@InterfaceAudience.Private public class RestoreSnapshotHelper extends Object
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:
Modifier and Type | Class and Description |
---|---|
static class |
RestoreSnapshotHelper.RestoreMetaChanges
Describe the set of operations needed to update hbase:meta after restore.
|
Constructor and Description |
---|
RestoreSnapshotHelper(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
SnapshotManifest manifest,
HTableDescriptor tableDescriptor,
org.apache.hadoop.fs.Path rootDir,
ForeignExceptionDispatcher monitor,
MonitoredTask status) |
RestoreSnapshotHelper(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
SnapshotManifest manifest,
HTableDescriptor tableDescriptor,
org.apache.hadoop.fs.Path rootDir,
ForeignExceptionDispatcher monitor,
MonitoredTask status,
boolean createBackRefs) |
Modifier and Type | Method and Description |
---|---|
HRegionInfo |
cloneRegionInfo(HRegionInfo snapshotRegionInfo)
Create a new
HRegionInfo from the snapshot region info. |
static HTableDescriptor |
cloneTableSchema(HTableDescriptor snapshotTableDescriptor,
TableName tableName)
Create a new table descriptor cloning the snapshot table schema.
|
static void |
copySnapshotForScanner(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootDir,
org.apache.hadoop.fs.Path restoreDir,
String snapshotName)
Copy the snapshot files for a snapshot scanner, discards meta changes.
|
RestoreSnapshotHelper.RestoreMetaChanges |
restoreHdfsRegions()
Restore the on-disk table to a specified snapshot state.
|
public RestoreSnapshotHelper(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, SnapshotManifest manifest, HTableDescriptor tableDescriptor, org.apache.hadoop.fs.Path rootDir, ForeignExceptionDispatcher monitor, MonitoredTask status)
public RestoreSnapshotHelper(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, SnapshotManifest manifest, HTableDescriptor tableDescriptor, org.apache.hadoop.fs.Path rootDir, ForeignExceptionDispatcher monitor, MonitoredTask status, boolean createBackRefs)
public RestoreSnapshotHelper.RestoreMetaChanges restoreHdfsRegions() throws IOException
IOException
public HRegionInfo cloneRegionInfo(HRegionInfo snapshotRegionInfo)
HRegionInfo
from the snapshot region info.
Keep the same startKey, endKey, regionId and split information but change
the table name.snapshotRegionInfo
- Info for region to clone.public static HTableDescriptor cloneTableSchema(HTableDescriptor snapshotTableDescriptor, TableName tableName) throws IOException
snapshotTableDescriptor
- tableName
- IOException
public static void copySnapshotForScanner(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.Path restoreDir, String snapshotName) throws IOException
conf
- fs
- rootDir
- restoreDir
- snapshotName
- IOException
Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.