@InterfaceAudience.Private public abstract class AbstractProtobufWALReader extends Object implements AbstractFSWALProvider.Initializer, Closeable
Modifier and Type | Field and Description |
---|---|
protected WALCellCodec.ByteStringUncompressor |
byteStringUncompressor |
protected Codec.Decoder |
cellDecoder |
protected String |
codecClsName |
protected CompressionContext |
compressionCtx |
protected org.apache.hadoop.conf.Configuration |
conf |
protected Decryptor |
decryptor |
(package private) static int |
DEFAULT_WAL_TRAILER_WARN_SIZE |
protected long |
fileLength |
protected org.apache.hadoop.fs.FileSystem |
fs |
protected boolean |
hasCompression |
protected boolean |
hasTagCompression |
protected boolean |
hasValueCompression |
protected org.apache.hadoop.fs.FSDataInputStream |
inputStream |
private static org.slf4j.Logger |
LOG |
protected org.apache.hadoop.fs.Path |
path |
static byte[] |
PB_WAL_COMPLETE_MAGIC |
static byte[] |
PB_WAL_MAGIC |
protected org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.WALTrailer |
trailer |
protected boolean |
trailerPresent |
protected int |
trailerWarnSize |
protected Compression.Algorithm |
valueCompressionType |
(package private) static String |
WAL_TRAILER_WARN_SIZE
Configuration name of WAL Trailer's warning size.
|
protected long |
walEditsStopOffset |
private static List<String> |
WRITER_CLS_NAMES |
Constructor and Description |
---|
AbstractProtobufWALReader() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected IOException |
extractHiddenEof(Exception ex) |
protected abstract InputStream |
getCellCodecInputStream(org.apache.hadoop.fs.FSDataInputStream stream)
Get or create the input stream used by cell decoder.
|
private WALCellCodec |
getCodec(org.apache.hadoop.conf.Configuration conf,
String cellCodecClsName,
CompressionContext compressionContext) |
String |
getCodecClsName()
Returns the cell codec classname
|
long |
getPosition() |
protected String |
getPositionQuietly() |
List<String> |
getWriterClsNames()
Returns names of the accepted writer classes
|
void |
init(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
org.apache.hadoop.conf.Configuration conf,
long startPosition)
A method to initialize a WAL reader.
|
private void |
initCompression(org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.WALHeader header) |
private void |
initDecryptor(org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.WALHeader header) |
protected void |
initWALCellCodec(org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.WALHeader header,
InputStream inputStream) |
protected boolean |
isWALTrailer(long startPosition)
This is used to determine whether we have already reached the WALTrailer.
|
protected Pair<org.apache.hadoop.fs.FSDataInputStream,org.apache.hadoop.fs.FileStatus> |
open() |
private Pair<org.apache.hadoop.fs.FSDataInputStream,org.apache.hadoop.fs.FileStatus> |
openArchivedWAL() |
protected boolean |
reachWALEditsStopOffset(long pos) |
protected org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.WALHeader |
readHeader(org.apache.hadoop.fs.FSDataInputStream stream) |
protected void |
readTrailer(org.apache.hadoop.fs.FSDataInputStream stream,
org.apache.hadoop.fs.FileStatus stat) |
private boolean |
setTrailerIfPresent(org.apache.hadoop.fs.FSDataInputStream stream)
To check whether a trailer is present in a WAL, it seeks to position (fileLength -
PB_WAL_COMPLETE_MAGIC.size() - Bytes.SIZEOF_INT).
|
protected abstract void |
skipTo(long position)
Skip to the given position.
|
long |
trailerSize() |
private static final org.slf4j.Logger LOG
public static final byte[] PB_WAL_MAGIC
public static final byte[] PB_WAL_COMPLETE_MAGIC
static final String WAL_TRAILER_WARN_SIZE
static final int DEFAULT_WAL_TRAILER_WARN_SIZE
private static final List<String> WRITER_CLS_NAMES
protected org.apache.hadoop.conf.Configuration conf
protected org.apache.hadoop.fs.FileSystem fs
protected org.apache.hadoop.fs.Path path
protected long fileLength
protected org.apache.hadoop.fs.FSDataInputStream inputStream
protected CompressionContext compressionCtx
protected boolean hasCompression
protected boolean hasTagCompression
protected boolean hasValueCompression
protected Compression.Algorithm valueCompressionType
protected Codec.Decoder cellDecoder
protected WALCellCodec.ByteStringUncompressor byteStringUncompressor
protected long walEditsStopOffset
protected boolean trailerPresent
protected org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.WALTrailer trailer
protected int trailerWarnSize
protected String codecClsName
public AbstractProtobufWALReader()
protected abstract InputStream getCellCodecInputStream(org.apache.hadoop.fs.FSDataInputStream stream)
protected abstract void skipTo(long position) throws IOException
IOException
public void init(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration conf, long startPosition) throws IOException
AbstractFSWALProvider.Initializer
init
in interface AbstractFSWALProvider.Initializer
startPosition
- the start position you want to read from, -1 means start reading from
the first WAL entry. Notice that, the first entry is not started at
position as we have several headers, so typically you should not pass 0
here.IOException
private Pair<org.apache.hadoop.fs.FSDataInputStream,org.apache.hadoop.fs.FileStatus> openArchivedWAL() throws IOException
IOException
protected final Pair<org.apache.hadoop.fs.FSDataInputStream,org.apache.hadoop.fs.FileStatus> open() throws IOException
IOException
protected final org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.WALHeader readHeader(org.apache.hadoop.fs.FSDataInputStream stream) throws IOException
IOException
private void initDecryptor(org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.WALHeader header) throws IOException
IOException
private void initCompression(org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.WALHeader header) throws IOException
IOException
private WALCellCodec getCodec(org.apache.hadoop.conf.Configuration conf, String cellCodecClsName, CompressionContext compressionContext) throws IOException
IOException
protected final void initWALCellCodec(org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.WALHeader header, InputStream inputStream) throws IOException
IOException
protected final void readTrailer(org.apache.hadoop.fs.FSDataInputStream stream, org.apache.hadoop.fs.FileStatus stat) throws IOException
IOException
private boolean setTrailerIfPresent(org.apache.hadoop.fs.FSDataInputStream stream) throws IOException
IOException
protected final boolean reachWALEditsStopOffset(long pos)
public List<String> getWriterClsNames()
public String getCodecClsName()
public long getPosition() throws IOException
IOException
public long trailerSize()
protected final String getPositionQuietly()
protected final IOException extractHiddenEof(Exception ex)
protected final boolean isWALTrailer(long startPosition) throws IOException
IOException
public void close()
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.