Class WALInputFormat
Simple
InputFormat for WAL files.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classhandler for non-deprecated WALKey version.(package private) static classWALInputFormat.WALRecordReader<K extends WALKey>RecordReaderfor anWALfile.static classInputSplitforWALfiles. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static voidaddFile(List<org.apache.hadoop.fs.FileStatus> result, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.LocatedFileStatus lfs, long startTime, long endTime) createRecordReader(org.apache.hadoop.mapreduce.InputSplit split, org.apache.hadoop.mapreduce.TaskAttemptContext context) (package private) List<org.apache.hadoop.fs.FileStatus>getFiles(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dir, long startTime, long endTime, org.apache.hadoop.conf.Configuration conf) (package private) org.apache.hadoop.fs.Path[]getInputPaths(org.apache.hadoop.conf.Configuration conf) List<org.apache.hadoop.mapreduce.InputSplit>getSplits(org.apache.hadoop.mapreduce.JobContext context) (package private) List<org.apache.hadoop.mapreduce.InputSplit>implementation shared with deprecated HLogInputFormatprivate static booleanisClosedBefore(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.LocatedFileStatus lfs, long time) Whether the file is closed and its final modification time precedestime.private static org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.LocatedFileStatus>listLocatedFileStatus(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dir, org.apache.hadoop.conf.Configuration conf) Attempts to return theLocatedFileStatusfor the given directory.
-
Field Details
-
LOG
-
START_TIME_KEY
- See Also:
-
END_TIME_KEY
- See Also:
-
-
Constructor Details
-
WALInputFormat
public WALInputFormat()
-
-
Method Details
-
getSplits
public List<org.apache.hadoop.mapreduce.InputSplit> getSplits(org.apache.hadoop.mapreduce.JobContext context) throws IOException, InterruptedException - Specified by:
getSplitsin classorg.apache.hadoop.mapreduce.InputFormat<WALKey,WALEdit> - Throws:
IOExceptionInterruptedException
-
getSplits
List<org.apache.hadoop.mapreduce.InputSplit> getSplits(org.apache.hadoop.mapreduce.JobContext context, String startKey, String endKey) throws IOException, InterruptedException implementation shared with deprecated HLogInputFormat- Throws:
IOExceptionInterruptedException
-
getInputPaths
-
getFiles
List<org.apache.hadoop.fs.FileStatus> getFiles(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dir, long startTime, long endTime, org.apache.hadoop.conf.Configuration conf) throws IOException - Parameters:
startTime- Files created before this time are dropped only if confirmed closed before it. Files without a parseable timestamp in their name are always included.endTime- Files created after this time are dropped. Files without a parseable timestamp in their name are always included.- Throws:
IOException
-
isClosedBefore
private static boolean isClosedBefore(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.LocatedFileStatus lfs, long time) Whether the file is closed and its final modification time precedestime. Only a closed file has a reliable modification time, so an open file or a non-HDFS file always returnsfalse(kept). When the file is confirmed closed, its status is re-fetched because thelfsfromlistLocatedStatusmay carry a stale creation-time mtime from when the file was still open. -
addFile
-
createRecordReader
public org.apache.hadoop.mapreduce.RecordReader<WALKey,WALEdit> createRecordReader(org.apache.hadoop.mapreduce.InputSplit split, org.apache.hadoop.mapreduce.TaskAttemptContext context) throws IOException, InterruptedException - Specified by:
createRecordReaderin classorg.apache.hadoop.mapreduce.InputFormat<WALKey,WALEdit> - Throws:
IOExceptionInterruptedException
-
listLocatedFileStatus
private static org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.LocatedFileStatus> listLocatedFileStatus(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dir, org.apache.hadoop.conf.Configuration conf) throws IOException Attempts to return theLocatedFileStatusfor the given directory. If the directory does not exist, it will check if the directory is an archived log file and try to find it- Throws:
IOException
-