Class ProtobufWALTailingReader
java.lang.Object
org.apache.hadoop.hbase.regionserver.wal.AbstractProtobufWALReader
org.apache.hadoop.hbase.regionserver.wal.ProtobufWALTailingReader
- All Implemented Interfaces:
 Closeable,AutoCloseable,AbstractFSWALProvider.Initializer,WALTailingReader
@Private
public class ProtobufWALTailingReader
extends AbstractProtobufWALReader
implements WALTailingReader
A WAL reader for replication. It supports reset so can be used to tail a WAL file which is being
 written currently.
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classNested classes/interfaces inherited from interface org.apache.hadoop.hbase.wal.WALTailingReader
WALTailingReader.Result, WALTailingReader.State - 
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DelegatingInputStreamprivate static final ProtobufWALTailingReader.ReadWALKeyResultprivate static final ProtobufWALTailingReader.ReadWALKeyResultprivate static final org.slf4j.LoggerFields inherited from class org.apache.hadoop.hbase.regionserver.wal.AbstractProtobufWALReader
byteStringUncompressor, cellDecoder, codecClsName, compressionCtx, conf, decryptor, DEFAULT_WAL_TRAILER_WARN_SIZE, fileLength, fs, hasCompression, hasTagCompression, hasValueCompression, inputStream, path, PB_WAL_COMPLETE_MAGIC, PB_WAL_MAGIC, trailer, trailerPresent, trailerWarnSize, valueCompressionType, WAL_TRAILER_WARN_SIZE, walEditsStopOffset - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionprivate WALTailingReader.ResulteditEof()private WALTailingReader.Resultprotected InputStreamgetCellCodecInputStream(org.apache.hadoop.fs.FSDataInputStream stream) Get or create the input stream used by cell decoder.next(long limit) Read the next entry and make sure the position after reading does not go beyond the givenlimit.private WALTailingReader.ResultreadWALEdit(WAL.Entry entry, int followingKvCount) readWALKey(long originalPosition) voidresetTo(long position, boolean resetCompression) Reopen the reader to see if there is new data arrives, and also seek(or skip) to the given position.private voidskipHeader(org.apache.hadoop.fs.FSDataInputStream stream) protected voidskipTo(long position) Skip to the given position.private IOExceptionMethods inherited from class org.apache.hadoop.hbase.regionserver.wal.AbstractProtobufWALReader
close, extractHiddenEof, getCodecClsName, getPosition, getPositionQuietly, getWriterClsNames, init, initWALCellCodec, isWALTrailer, open, reachWALEditsStopOffset, readHeader, readTrailer, trailerSizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.wal.WALTailingReader
close, getPosition 
- 
Field Details
- 
LOG
 - 
delegatingInput
 - 
KEY_ERROR_AND_RESET
 - 
KEY_EOF_AND_RESET
 
 - 
 - 
Constructor Details
- 
ProtobufWALTailingReader
public ProtobufWALTailingReader() 
 - 
 - 
Method Details
- 
unwrapIPBE
 - 
readWALKey
 - 
editEof
 - 
editError
 - 
readWALEdit
 - 
next
Description copied from interface:WALTailingReaderRead the next entry and make sure the position after reading does not go beyond the givenlimit. 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.- Specified by:
 nextin interfaceWALTailingReader- Parameters:
 limit- the position limit. See HBASE-14004 for more details about why we need this limitation. -1 means no limit.
 - 
skipHeader
- Throws:
 IOException
 - 
resetTo
Description copied from interface:WALTailingReaderReopen the reader to see if there is new data arrives, and also seek(or skip) to the given position. If you want to read from the beginning instead of a given position, please pass -1 asposition, 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.- Specified by:
 resetToin interfaceWALTailingReader- Parameters:
 position- 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. Iftrue, we will use skip instead of seek after resetting.- Throws:
 IOException
 - 
getCellCodecInputStream
Description copied from class:AbstractProtobufWALReaderGet or create the input stream used by cell decoder. For implementing replication, we may need to limit the bytes we can read, so here we provide a method so subclasses can wrap the original input stream.- Specified by:
 getCellCodecInputStreamin classAbstractProtobufWALReader
 - 
skipTo
Description copied from class:AbstractProtobufWALReaderSkip to the given position.- Specified by:
 skipToin classAbstractProtobufWALReader- Throws:
 IOException
 
 -