@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 metricsIOExceptionpublic boolean hasNext() throws IOException
WAL.EntryIOExceptionpublic WAL.Entry peek() throws IOException
IOExceptionpublic WAL.Entry next() throws IOException
IOExceptionpublic void close() throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic long getPosition()
public org.apache.hadoop.fs.Path getCurrentPath()
Path of the current WALprivate String getCurrentPathStat()
public void reset() throws IOException
IOExceptionprivate void setPosition(long position)
private void setCurrentPath(org.apache.hadoop.fs.Path path)
private void tryAdvanceEntry() throws IOException
IOExceptionprivate boolean checkAllBytesParsed() throws IOException
IOExceptionprivate void dequeueCurrentLog() throws IOException
IOExceptionprivate boolean readNextEntryAndRecordReaderPosition() throws IOException
IOExceptionprivate void closeReader() throws IOException
IOExceptionprivate boolean checkReader() throws IOException
IOExceptionprivate boolean openNextLog() throws IOException
IOExceptionprivate org.apache.hadoop.fs.Path getArchivedLog(org.apache.hadoop.fs.Path path) throws IOException
IOExceptionprivate void handleFileNotFound(org.apache.hadoop.fs.Path path, FileNotFoundException fnfe) throws IOException
IOExceptionprivate void openReader(org.apache.hadoop.fs.Path path) throws IOException
IOExceptionprivate void recoverLease(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path path)
private void resetReader() throws IOException
IOExceptionprivate void seek() throws IOException
IOExceptionprivate long currentTrailerSize()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.