Class MultiTableSnapshotInputFormatImpl
java.lang.Object
org.apache.hadoop.hbase.mapreduce.MultiTableSnapshotInputFormatImpl
Shared implementation of mapreduce code over multiple table snapshots. Utilized by both mapreduce
MultiTableSnapshotInputFormat
and mapred
MultiTableSnapshotInputFormat
implementations.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongenerateSnapshotToRestoreDirMapping
(Collection<String> snapshots, org.apache.hadoop.fs.Path baseRestoreDir) Generate a random path underneath baseRestoreDir for each snapshot in snapshots and return a map from the snapshot to the restore directory.getSnapshotDirs
(org.apache.hadoop.conf.Configuration conf) Retrieve the directories into which snapshots have been restored from (RESTORE_DIRS_KEY
)getSnapshotsToScans
(org.apache.hadoop.conf.Configuration conf) Retrieve the snapshot name -> list<scan> mapping pushed to configuration bysetSnapshotToScans(Configuration, Map)
getSplits
(org.apache.hadoop.conf.Configuration conf) Return the list of splits extracted from the scans/snapshots pushed to conf bysetInput(Configuration, Map, Path)
(package private) void
restoreSnapshot
(org.apache.hadoop.conf.Configuration conf, String snapshotName, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.Path restoreDir, org.apache.hadoop.fs.FileSystem fs) void
restoreSnapshots
(org.apache.hadoop.conf.Configuration conf, Map<String, org.apache.hadoop.fs.Path> snapshotToDir, org.apache.hadoop.fs.FileSystem fs) Restore each (snapshot name, restore directory) pair in snapshotToDirvoid
setInput
(org.apache.hadoop.conf.Configuration conf, Map<String, Collection<Scan>> snapshotScans, org.apache.hadoop.fs.Path restoreDir) Configure conf to read from snapshotScans, with snapshots restored to a subdirectory of restoreDir.void
setSnapshotDirs
(org.apache.hadoop.conf.Configuration conf, Map<String, org.apache.hadoop.fs.Path> snapshotDirs) void
setSnapshotToScans
(org.apache.hadoop.conf.Configuration conf, Map<String, Collection<Scan>> snapshotScans) Push snapshotScans to conf (under the keySNAPSHOT_TO_SCANS_KEY
)
-
Field Details
-
LOG
-
RESTORE_DIRS_KEY
- See Also:
-
SNAPSHOT_TO_SCANS_KEY
- See Also:
-
-
Constructor Details
-
MultiTableSnapshotInputFormatImpl
public MultiTableSnapshotInputFormatImpl()
-
-
Method Details
-
setInput
public void setInput(org.apache.hadoop.conf.Configuration conf, Map<String, Collection<Scan>> snapshotScans, org.apache.hadoop.fs.Path restoreDir) throws IOExceptionConfigure conf to read from snapshotScans, with snapshots restored to a subdirectory of restoreDir. Sets:RESTORE_DIRS_KEY
,SNAPSHOT_TO_SCANS_KEY
- Throws:
IOException
-
getSplits
public List<TableSnapshotInputFormatImpl.InputSplit> getSplits(org.apache.hadoop.conf.Configuration conf) throws IOException Return the list of splits extracted from the scans/snapshots pushed to conf bysetInput(Configuration, Map, Path)
- Parameters:
conf
- Configuration to determine splits from- Returns:
- Return the list of splits extracted from the scans/snapshots pushed to conf
- Throws:
IOException
-
getSnapshotsToScans
public Map<String,Collection<Scan>> getSnapshotsToScans(org.apache.hadoop.conf.Configuration conf) throws IOException Retrieve the snapshot name -> list<scan> mapping pushed to configuration bysetSnapshotToScans(Configuration, Map)
- Parameters:
conf
- Configuration to extract name -> list<scan> mappings from.- Returns:
- the snapshot name -> list<scan> mapping pushed to configuration
- Throws:
IOException
-
setSnapshotToScans
public void setSnapshotToScans(org.apache.hadoop.conf.Configuration conf, Map<String, Collection<Scan>> snapshotScans) throws IOExceptionPush snapshotScans to conf (under the keySNAPSHOT_TO_SCANS_KEY
)- Throws:
IOException
-
getSnapshotDirs
public Map<String,org.apache.hadoop.fs.Path> getSnapshotDirs(org.apache.hadoop.conf.Configuration conf) throws IOException Retrieve the directories into which snapshots have been restored from (RESTORE_DIRS_KEY
)- Parameters:
conf
- Configuration to extract restore directories from- Returns:
- the directories into which snapshots have been restored from
- Throws:
IOException
-
setSnapshotDirs
public void setSnapshotDirs(org.apache.hadoop.conf.Configuration conf, Map<String, org.apache.hadoop.fs.Path> snapshotDirs) -
generateSnapshotToRestoreDirMapping
private Map<String,org.apache.hadoop.fs.Path> generateSnapshotToRestoreDirMapping(Collection<String> snapshots, org.apache.hadoop.fs.Path baseRestoreDir) Generate a random path underneath baseRestoreDir for each snapshot in snapshots and return a map from the snapshot to the restore directory.- Parameters:
snapshots
- collection of snapshot names to restorebaseRestoreDir
- base directory under which all snapshots in snapshots will be restored- Returns:
- a mapping from snapshot name to the directory in which that snapshot has been restored
-
restoreSnapshots
public void restoreSnapshots(org.apache.hadoop.conf.Configuration conf, Map<String, org.apache.hadoop.fs.Path> snapshotToDir, org.apache.hadoop.fs.FileSystem fs) throws IOExceptionRestore each (snapshot name, restore directory) pair in snapshotToDir- Parameters:
conf
- configuration to restore withsnapshotToDir
- mapping from snapshot names to restore directoriesfs
- filesystem to do snapshot restoration on- Throws:
IOException
-
restoreSnapshot
void restoreSnapshot(org.apache.hadoop.conf.Configuration conf, String snapshotName, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.Path restoreDir, org.apache.hadoop.fs.FileSystem fs) throws IOException - Throws:
IOException
-