@InterfaceAudience.Private public class RestoreTool extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
backupId |
protected org.apache.hadoop.fs.Path |
backupRootPath |
protected org.apache.hadoop.conf.Configuration |
conf |
protected org.apache.hadoop.fs.FileSystem |
fs |
private String[] |
ignoreDirs |
static org.slf4j.Logger |
LOG |
protected org.apache.hadoop.fs.Path |
restoreRootDir |
private HashMap<TableName,org.apache.hadoop.fs.Path> |
snapshotMap |
private static long |
TABLE_AVAILABILITY_WAIT_TIME |
Constructor and Description |
---|
RestoreTool(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path backupRootPath,
org.apache.hadoop.fs.Path restoreRootDir,
String backupId) |
Modifier and Type | Method and Description |
---|---|
private void |
checkAndCreateTable(Connection conn,
TableName targetTableName,
ArrayList<org.apache.hadoop.fs.Path> regionDirList,
TableDescriptor htd,
boolean truncateIfExists)
Prepare the table for bulkload, most codes copied from
createTable method in
BulkLoadHFilesTool . |
private void |
createAndRestoreTable(Connection conn,
TableName tableName,
TableName newTableName,
org.apache.hadoop.fs.Path tableBackupPath,
boolean truncateIfExists,
String lastIncrBackupId) |
void |
fullRestoreTable(Connection conn,
org.apache.hadoop.fs.Path tableBackupPath,
TableName tableName,
TableName newTableName,
boolean truncateIfExists,
String lastIncrBackupId) |
(package private) byte[][] |
generateBoundaryKeys(ArrayList<org.apache.hadoop.fs.Path> regionDirList)
Calculate region boundaries and add all the column families to the table descriptor
|
(package private) ArrayList<org.apache.hadoop.fs.Path> |
getRegionList(org.apache.hadoop.fs.Path tableArchivePath)
Gets region list
|
(package private) ArrayList<org.apache.hadoop.fs.Path> |
getRegionList(TableName tableName)
Gets region list
|
(package private) org.apache.hadoop.fs.Path |
getTableArchivePath(TableName tableName)
return value represent path for:
".../user/biadmin/backup1/default/t1_dn/backup_1396650096738/archive/data/default/t1_dn"
|
(package private) TableDescriptor |
getTableDesc(TableName tableName)
Get table descriptor
|
private TableDescriptor |
getTableDescriptor(org.apache.hadoop.fs.FileSystem fileSys,
TableName tableName,
String lastIncrBackupId) |
(package private) org.apache.hadoop.fs.Path |
getTableInfoPath(TableName tableName)
Returns value represent path for:
""/$USER/SBACKUP_ROOT/backup_id/namespace/table/.hbase-snapshot/
snapshot_1396650097621_namespace_table" this path contains .snapshotinfo, .tabledesc (0.96 and
0.98) this path contains .snapshotinfo, .data.manifest (trunk)
|
(package private) org.apache.hadoop.fs.Path |
getTableSnapshotPath(org.apache.hadoop.fs.Path backupRootPath,
TableName tableName,
String backupId)
Returns value represent path for path to backup table snapshot directory:
"/$USER/SBACKUP_ROOT/backup_id/namespace/table/.hbase-snapshot"
|
void |
incrementalRestoreTable(Connection conn,
org.apache.hadoop.fs.Path tableBackupPath,
org.apache.hadoop.fs.Path[] logDirs,
TableName[] tableNames,
TableName[] newTableNames,
String incrBackupId)
During incremental backup operation.
|
(package private) void |
modifyTableSync(Connection conn,
TableDescriptor desc) |
public static final org.slf4j.Logger LOG
private static final long TABLE_AVAILABILITY_WAIT_TIME
private final String[] ignoreDirs
protected org.apache.hadoop.conf.Configuration conf
protected org.apache.hadoop.fs.Path backupRootPath
protected org.apache.hadoop.fs.Path restoreRootDir
protected org.apache.hadoop.fs.FileSystem fs
private final HashMap<TableName,org.apache.hadoop.fs.Path> snapshotMap
public RestoreTool(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path backupRootPath, org.apache.hadoop.fs.Path restoreRootDir, String backupId) throws IOException
IOException
org.apache.hadoop.fs.Path getTableArchivePath(TableName tableName) throws IOException
tableName
- table nameIOException
- exceptionArrayList<org.apache.hadoop.fs.Path> getRegionList(TableName tableName) throws IOException
tableName
- table nameIOException
- exceptionvoid modifyTableSync(Connection conn, TableDescriptor desc) throws IOException
IOException
public void incrementalRestoreTable(Connection conn, org.apache.hadoop.fs.Path tableBackupPath, org.apache.hadoop.fs.Path[] logDirs, TableName[] tableNames, TableName[] newTableNames, String incrBackupId) throws IOException
conn
- HBase connectiontableBackupPath
- backup pathlogDirs
- : incremental backup folders, which contains WALtableNames
- : source tableNames(table names were backuped)newTableNames
- : target tableNames(table names to be restored to)incrBackupId
- incremental backup IdIOException
- exceptionpublic void fullRestoreTable(Connection conn, org.apache.hadoop.fs.Path tableBackupPath, TableName tableName, TableName newTableName, boolean truncateIfExists, String lastIncrBackupId) throws IOException
IOException
org.apache.hadoop.fs.Path getTableSnapshotPath(org.apache.hadoop.fs.Path backupRootPath, TableName tableName, String backupId)
backupRootPath
- backup root pathtableName
- table namebackupId
- backup Idorg.apache.hadoop.fs.Path getTableInfoPath(TableName tableName) throws IOException
tableName
- table nameIOException
- exceptionTableDescriptor getTableDesc(TableName tableName) throws IOException
tableName
- is the table backed upTableDescriptor
saved in backup image of the tableIOException
private TableDescriptor getTableDescriptor(org.apache.hadoop.fs.FileSystem fileSys, TableName tableName, String lastIncrBackupId) throws IOException
IOException
private void createAndRestoreTable(Connection conn, TableName tableName, TableName newTableName, org.apache.hadoop.fs.Path tableBackupPath, boolean truncateIfExists, String lastIncrBackupId) throws IOException
IOException
ArrayList<org.apache.hadoop.fs.Path> getRegionList(org.apache.hadoop.fs.Path tableArchivePath) throws IOException
tableArchivePath
- table archive pathIOException
- exceptionbyte[][] generateBoundaryKeys(ArrayList<org.apache.hadoop.fs.Path> regionDirList) throws IOException
regionDirList
- region dir listIOException
private void checkAndCreateTable(Connection conn, TableName targetTableName, ArrayList<org.apache.hadoop.fs.Path> regionDirList, TableDescriptor htd, boolean truncateIfExists) throws IOException
createTable
method in
BulkLoadHFilesTool
.conn
- connectiontargetTableName
- target table nameregionDirList
- region directory listhtd
- table descriptortruncateIfExists
- truncates table if existsIOException
- exceptionCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.