Package org.apache.hadoop.hbase.snapshot
Class ExportSnapshot.ExportMapper
java.lang.Object
org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable,org.apache.hadoop.io.NullWritable,org.apache.hadoop.io.NullWritable,org.apache.hadoop.io.NullWritable>
org.apache.hadoop.hbase.snapshot.ExportSnapshot.ExportMapper
- Enclosing class:
- ExportSnapshot
private static class ExportSnapshot.ExportMapper
extends org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable,org.apache.hadoop.io.NullWritable,org.apache.hadoop.io.NullWritable,org.apache.hadoop.io.NullWritable>
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.mapreduce.Mapper
org.apache.hadoop.mapreduce.Mapper.Context
-
Field Summary
Modifier and TypeFieldDescription(package private) static final int
private int
private String
private short
private String
private org.apache.hadoop.fs.Path
private org.apache.hadoop.fs.FileSystem
private org.apache.hadoop.fs.Path
private static final org.slf4j.Logger
private org.apache.hadoop.fs.Path
private org.apache.hadoop.fs.FileSystem
private org.apache.hadoop.fs.Path
(package private) static final int
private static ExportSnapshot.Testing
private boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate void
copyData
(org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable, org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable>.org.apache.hadoop.mapreduce.Mapper.Context context, org.apache.hadoop.fs.Path inputPath, InputStream in, org.apache.hadoop.fs.Path outputPath, org.apache.hadoop.fs.FSDataOutputStream out, long inputFileSize) private void
copyFile
(org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable, org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable>.org.apache.hadoop.mapreduce.Mapper.Context context, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotFileInfo inputInfo, org.apache.hadoop.fs.Path outputPath) private void
createOutputPath
(org.apache.hadoop.fs.Path path) Create the output folder and optionally set ownership.private org.apache.hadoop.fs.FileChecksum
getFileChecksum
(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path) private FileLink
getFileLink
(org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration conf) private org.apache.hadoop.fs.Path
getOutputPath
(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotFileInfo inputInfo) Returns the location where the inputPath will be copied.private org.apache.hadoop.fs.FileStatus
getSourceFileStatus
(org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable, org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable>.org.apache.hadoop.mapreduce.Mapper.Context context, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotFileInfo fileInfo) private void
injectTestFailure
(org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable, org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable>.org.apache.hadoop.mapreduce.Mapper.Context context, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotFileInfo inputInfo) void
map
(org.apache.hadoop.io.BytesWritable key, org.apache.hadoop.io.NullWritable value, org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable, org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable>.org.apache.hadoop.mapreduce.Mapper.Context context) private org.apache.hadoop.fs.FSDataInputStream
openSourceFile
(org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable, org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable>.org.apache.hadoop.mapreduce.Mapper.Context context, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotFileInfo fileInfo) Try to open the "source" file.private boolean
preserveAttributes
(org.apache.hadoop.fs.Path path, org.apache.hadoop.fs.FileStatus refStat) Try to Preserve the files attribute selected by the user copying them from the source file This is only required when you are exporting as a different user than "hbase" or on a system that doesn't have the "hbase" user.private boolean
sameFile
(org.apache.hadoop.fs.FileStatus inputStat, org.apache.hadoop.fs.FileStatus outputStat) Check if the two files are equal by looking at the file length, and at the checksum (if user has specified the verifyChecksum flag).void
setup
(org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable, org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable>.org.apache.hadoop.mapreduce.Mapper.Context context) private boolean
stringIsNotEmpty
(String str) Methods inherited from class org.apache.hadoop.mapreduce.Mapper
cleanup, run
-
Field Details
-
LOG
-
REPORT_SIZE
- See Also:
-
BUFFER_SIZE
- See Also:
-
verifyChecksum
-
filesGroup
-
filesUser
-
filesMode
-
bufferSize
-
outputFs
-
outputArchive
-
outputRoot
-
inputFs
-
inputArchive
-
inputRoot
-
testing
-
-
Constructor Details
-
ExportMapper
private ExportMapper()
-
-
Method Details
-
setup
public void setup(org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable, org.apache.hadoop.io.NullWritable, throws IOExceptionorg.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable>.org.apache.hadoop.mapreduce.Mapper.Context context) - Overrides:
setup
in classorg.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable,
org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable> - Throws:
IOException
-
map
public void map(org.apache.hadoop.io.BytesWritable key, org.apache.hadoop.io.NullWritable value, org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable, org.apache.hadoop.io.NullWritable, throws InterruptedException, IOExceptionorg.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable>.org.apache.hadoop.mapreduce.Mapper.Context context) - Overrides:
map
in classorg.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable,
org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable> - Throws:
InterruptedException
IOException
-
getOutputPath
private org.apache.hadoop.fs.Path getOutputPath(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotFileInfo inputInfo) throws IOException Returns the location where the inputPath will be copied.- Throws:
IOException
-
injectTestFailure
private void injectTestFailure(org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable, org.apache.hadoop.io.NullWritable, throws IOExceptionorg.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable>.org.apache.hadoop.mapreduce.Mapper.Context context, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotFileInfo inputInfo) - Throws:
IOException
-
copyFile
private void copyFile(org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable, org.apache.hadoop.io.NullWritable, throws IOExceptionorg.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable>.org.apache.hadoop.mapreduce.Mapper.Context context, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotFileInfo inputInfo, org.apache.hadoop.fs.Path outputPath) - Throws:
IOException
-
createOutputPath
Create the output folder and optionally set ownership.- Throws:
IOException
-
preserveAttributes
private boolean preserveAttributes(org.apache.hadoop.fs.Path path, org.apache.hadoop.fs.FileStatus refStat) Try to Preserve the files attribute selected by the user copying them from the source file This is only required when you are exporting as a different user than "hbase" or on a system that doesn't have the "hbase" user. This is not considered a blocking failure since the user can force a chmod with the user that knows is available on the system. -
stringIsNotEmpty
-
copyData
private void copyData(org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable, org.apache.hadoop.io.NullWritable, throws IOExceptionorg.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable>.org.apache.hadoop.mapreduce.Mapper.Context context, org.apache.hadoop.fs.Path inputPath, InputStream in, org.apache.hadoop.fs.Path outputPath, org.apache.hadoop.fs.FSDataOutputStream out, long inputFileSize) - Throws:
IOException
-
openSourceFile
private org.apache.hadoop.fs.FSDataInputStream openSourceFile(org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable, org.apache.hadoop.io.NullWritable, throws IOExceptionorg.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable>.org.apache.hadoop.mapreduce.Mapper.Context context, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotFileInfo fileInfo) Try to open the "source" file. Throws an IOException if the communication with the inputFs fail or if the file is not found.- Throws:
IOException
-
getSourceFileStatus
private org.apache.hadoop.fs.FileStatus getSourceFileStatus(org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.BytesWritable, org.apache.hadoop.io.NullWritable, throws IOExceptionorg.apache.hadoop.io.NullWritable, org.apache.hadoop.io.NullWritable>.org.apache.hadoop.mapreduce.Mapper.Context context, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotFileInfo fileInfo) - Throws:
IOException
-
getFileLink
private FileLink getFileLink(org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration conf) throws IOException - Throws:
IOException
-
getFileChecksum
private org.apache.hadoop.fs.FileChecksum getFileChecksum(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path) -
sameFile
private boolean sameFile(org.apache.hadoop.fs.FileStatus inputStat, org.apache.hadoop.fs.FileStatus outputStat) Check if the two files are equal by looking at the file length, and at the checksum (if user has specified the verifyChecksum flag).
-