@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 |
currentPosition |
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() |
private boolean |
openNextLog() |
private void |
openReader(org.apache.hadoop.fs.Path path) |
private boolean |
readNextEntryAndSetPosition()
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 currentPosition
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 next() throws IOException
IOExceptionNoSuchElementException - if no more entries in the stream.public 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 readNextEntryAndSetPosition() 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–2019 The Apache Software Foundation. All rights reserved.