@InterfaceAudience.Private @InterfaceStability.Evolving class WALEntryStream extends Object implements Closeable
Path
, and continually
iterates through all the WAL WAL.Entry
in the queue. When it's done reading from a Path, it
dequeues it and starts reading from the next.Modifier and Type | Field and Description |
---|---|
private org.apache.hadoop.conf.Configuration |
conf |
private WAL.Entry |
currentEntry |
private org.apache.hadoop.fs.Path |
currentPath |
private long |
currentPositionOfEntry |
private long |
currentPositionOfReader |
private org.apache.hadoop.fs.FileSystem |
fs |
private static org.slf4j.Logger |
LOG |
private PriorityBlockingQueue<org.apache.hadoop.fs.Path> |
logQueue |
private MetricsSource |
metrics |
private WAL.Reader |
reader |
private ServerName |
serverName |
private WALFileLengthProvider |
walFileLengthProvider |
Constructor and Description |
---|
WALEntryStream(PriorityBlockingQueue<org.apache.hadoop.fs.Path> logQueue,
org.apache.hadoop.conf.Configuration conf,
long startPosition,
WALFileLengthProvider walFileLengthProvider,
ServerName serverName,
MetricsSource metrics)
Create an entry stream over the given queue at the given start position
|
Modifier and Type | Method and Description |
---|---|
private boolean |
checkAllBytesParsed() |
private boolean |
checkReader() |
void |
close() |
private void |
closeReader() |
private long |
currentTrailerSize() |
private void |
dequeueCurrentLog() |
private org.apache.hadoop.fs.Path |
getArchivedLog(org.apache.hadoop.fs.Path path) |
org.apache.hadoop.fs.Path |
getCurrentPath() |
private String |
getCurrentPathStat() |
long |
getPosition() |
private void |
handleFileNotFound(org.apache.hadoop.fs.Path path,
FileNotFoundException fnfe) |
boolean |
hasNext() |
WAL.Entry |
next()
Returns the next WAL entry in this stream and advance the stream.
|
private boolean |
openNextLog() |
private void |
openReader(org.apache.hadoop.fs.Path path) |
WAL.Entry |
peek()
Returns the next WAL entry in this stream but does not advance.
|
private boolean |
readNextEntryAndRecordReaderPosition()
Returns whether the file is opened for writing.
|
private void |
recoverLease(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path path) |
void |
reset()
Should be called if the stream is to be reused (i.e.
|
private void |
resetReader() |
private void |
seek() |
private void |
setCurrentPath(org.apache.hadoop.fs.Path path) |
private void |
setPosition(long position) |
private void |
tryAdvanceEntry() |
private static final org.slf4j.Logger LOG
private WAL.Reader reader
private org.apache.hadoop.fs.Path currentPath
private WAL.Entry currentEntry
private long currentPositionOfEntry
private long currentPositionOfReader
private final PriorityBlockingQueue<org.apache.hadoop.fs.Path> logQueue
private final org.apache.hadoop.fs.FileSystem fs
private final org.apache.hadoop.conf.Configuration conf
private final WALFileLengthProvider walFileLengthProvider
private final ServerName serverName
private final MetricsSource metrics
public WALEntryStream(PriorityBlockingQueue<org.apache.hadoop.fs.Path> logQueue, org.apache.hadoop.conf.Configuration conf, long startPosition, WALFileLengthProvider walFileLengthProvider, ServerName serverName, MetricsSource metrics) throws IOException
logQueue
- the queue of WAL pathsconf
- the Configuration
to use to create WAL.Reader
for this streamstartPosition
- the position in the first WAL to start reading atwalFileLengthProvider
- provides the length of the WAL fileserverName
- the server name which all WALs belong tometrics
- the replication metricsIOException
public boolean hasNext() throws IOException
WAL.Entry
IOException
public WAL.Entry peek() throws IOException
IOException
public WAL.Entry next() throws IOException
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public long getPosition()
public org.apache.hadoop.fs.Path getCurrentPath()
Path
of the current WALprivate String getCurrentPathStat()
public void reset() throws IOException
IOException
private void setPosition(long position)
private void setCurrentPath(org.apache.hadoop.fs.Path path)
private void tryAdvanceEntry() throws IOException
IOException
private boolean checkAllBytesParsed() throws IOException
IOException
private void dequeueCurrentLog() throws IOException
IOException
private boolean readNextEntryAndRecordReaderPosition() throws IOException
IOException
private void closeReader() throws IOException
IOException
private boolean checkReader() throws IOException
IOException
private boolean openNextLog() throws IOException
IOException
private org.apache.hadoop.fs.Path getArchivedLog(org.apache.hadoop.fs.Path path) throws IOException
IOException
private void handleFileNotFound(org.apache.hadoop.fs.Path path, FileNotFoundException fnfe) throws IOException
IOException
private void openReader(org.apache.hadoop.fs.Path path) throws IOException
IOException
private void recoverLease(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path path)
private void resetReader() throws IOException
IOException
private void seek() throws IOException
IOException
private long currentTrailerSize()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.