@InterfaceAudience.Private public class ProtobufWALTailingReader extends AbstractProtobufWALReader implements WALTailingReader
WALTailingReader.Result, WALTailingReader.StatebyteStringUncompressor, cellDecoder, codecClsName, compressionCtx, conf, decryptor, fileLength, fs, hasCompression, hasTagCompression, hasValueCompression, inputStream, path, PB_WAL_COMPLETE_MAGIC, PB_WAL_MAGIC, trailer, trailerPresent, trailerWarnSize, valueCompressionType, walEditsStopOffset| Constructor and Description |
|---|
ProtobufWALTailingReader() |
| Modifier and Type | Method and Description |
|---|---|
protected InputStream |
getCellCodecInputStream(org.apache.hadoop.fs.FSDataInputStream stream)
Get or create the input stream used by cell decoder.
|
WALTailingReader.Result |
next(long limit)
Read the next entry and make sure the position after reading does not go beyond the given
limit. |
void |
resetTo(long position,
boolean resetCompression)
Reopen the reader to see if there is new data arrives, and also seek(or skip) to the given
position.
|
protected void |
skipTo(long position)
Skip to the given position.
|
close, extractHiddenEof, getCodecClsName, getPosition, getPositionQuietly, getWriterClsNames, init, initWALCellCodec, isWALTrailer, open, reachWALEditsStopOffset, readHeader, readTrailer, trailerSizeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, getPositionpublic WALTailingReader.Result next(long limit)
WALTailingReaderlimit.
Notice that we will not throw any checked exception out, all the states are represented by the
return value. Of course we will log the exceptions out. The reason why we do this is that, for
tailing a WAL file which is currently being written, we will hit EOFException many times, so it
should not be considered as an 'exception' and also, creating an Exception is a bit expensive.next in interface WALTailingReaderlimit - the position limit. See HBASE-14004 for more details about why we need this
limitation. -1 means no limit.public void resetTo(long position,
boolean resetCompression)
throws IOException
WALTailingReaderposition, then the reader will locate to the first entry. Notice that, since we have a
magic header and a pb header, the first WAL entry is not located at position 0, so passing 0
will cause trouble.resetTo in interface WALTailingReaderposition - the position we want to start reading from after resetting, or -1 if
you want to start reading from the beginning.resetCompression - whether we also need to clear the compression context. If true,
we will use skip instead of seek after resetting.IOExceptionprotected InputStream getCellCodecInputStream(org.apache.hadoop.fs.FSDataInputStream stream)
AbstractProtobufWALReadergetCellCodecInputStream in class AbstractProtobufWALReaderprotected void skipTo(long position)
throws IOException
AbstractProtobufWALReaderskipTo in class AbstractProtobufWALReaderIOExceptionCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.