@InterfaceAudience.LimitedPrivate(value={"Coprocesssor","Phoenix","Configuration"})
public class ProtobufLogReader
extends ReaderBase
<PB_WAL_MAGIC><WALHeader><WALEdits>...<WALEdits><Trailer> <TrailerSize> <PB_WAL_COMPLETE_MAGIC>
The Reader reads meta information (WAL Compression state, WALTrailer, etc) in ProtobufLogReader#initReader(FSDataInputStream). A WALTrailer is an extensible structure which is appended at the end of the WAL. This is empty for now; it can contain some meta information such as Region level stats, etc in future.| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
ProtobufLogReader.WALHdrContext |
(package private) static class |
ProtobufLogReader.WALHdrResult |
| Modifier and Type | Field and Description |
|---|---|
protected WALCellCodec.ByteStringUncompressor |
byteStringUncompressor |
protected Codec.Decoder |
cellDecoder |
private String |
codecClsName |
(package private) static int |
DEFAULT_WAL_TRAILER_WARN_SIZE |
protected boolean |
hasCompression |
protected boolean |
hasTagCompression |
protected org.apache.hadoop.fs.FSDataInputStream |
inputStream |
private static org.slf4j.Logger |
LOG |
static byte[] |
PB_WAL_COMPLETE_MAGIC |
static byte[] |
PB_WAL_MAGIC |
protected org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.WALTrailer |
trailer |
private boolean |
trailerPresent |
protected int |
trailerWarnSize |
(package private) static String |
WAL_TRAILER_WARN_SIZE
Configuration name of WAL Trailer's warning size.
|
private long |
walEditsStopOffset |
private static List<String> |
writerClsNames |
compressionContext, conf, edit, emptyCompressionContext, fileLength, fs, path| Constructor and Description |
|---|
ProtobufLogReader() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
private IOException |
extractHiddenEof(Exception ex) |
protected WALCellCodec |
getCodec(org.apache.hadoop.conf.Configuration conf,
String cellCodecClsName,
CompressionContext compressionContext) |
String |
getCodecClsName() |
long |
getPosition() |
List<String> |
getWriterClsNames() |
protected boolean |
hasCompression() |
protected boolean |
hasTagCompression() |
void |
init(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FSDataInputStream stream) |
protected void |
initAfterCompression()
Initializes the compression after the shared stuff has been initialized.
|
protected void |
initAfterCompression(String cellCodecClsName)
Initializes the compression after the shared stuff has been initialized.
|
private String |
initInternal(org.apache.hadoop.fs.FSDataInputStream stream,
boolean isFirst) |
protected String |
initReader(org.apache.hadoop.fs.FSDataInputStream stream)
Initializes the log reader with a particular stream (may be null).
|
protected ProtobufLogReader.WALHdrContext |
readHeader(org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.WALHeader.Builder builder,
org.apache.hadoop.fs.FSDataInputStream stream) |
protected boolean |
readNext(WAL.Entry entry)
Read next entry.
|
void |
reset() |
protected void |
seekOnFs(long pos)
Performs a filesystem-level seek to a certain position in an underlying file.
|
private boolean |
setTrailerIfPresent()
To check whether a trailer is present in a WAL, it seeks to position (fileLength -
PB_WAL_COMPLETE_MAGIC.size() - Bytes.SIZEOF_INT).
|
long |
trailerSize() |
next, next, seekprivate static final org.slf4j.Logger LOG
@InterfaceAudience.Private public static final byte[] PB_WAL_MAGIC
@InterfaceAudience.Private public static final byte[] PB_WAL_COMPLETE_MAGIC
static final String WAL_TRAILER_WARN_SIZE
static final int DEFAULT_WAL_TRAILER_WARN_SIZE
protected org.apache.hadoop.fs.FSDataInputStream inputStream
protected Codec.Decoder cellDecoder
protected WALCellCodec.ByteStringUncompressor byteStringUncompressor
protected boolean hasCompression
protected boolean hasTagCompression
private long walEditsStopOffset
private boolean trailerPresent
protected org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.WALTrailer trailer
protected int trailerWarnSize
private static List<String> writerClsNames
private String codecClsName
public ProtobufLogReader()
@InterfaceAudience.Private public long trailerSize()
public void close() throws IOException
IOExceptionpublic long getPosition() throws IOException
IOExceptionpublic void reset() throws IOException
IOExceptionpublic void init(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FSDataInputStream stream) throws IOException
init in interface AbstractFSWALProvider.Readerinit in class ReaderBasefs - File system.path - Path.conf - Configuration.stream - Input stream that may have been pre-opened by the caller; may be null.IOExceptionprotected String initReader(org.apache.hadoop.fs.FSDataInputStream stream) throws IOException
ReaderBaseinitReader in class ReaderBaseIOExceptionpublic List<String> getWriterClsNames()
public String getCodecClsName()
protected ProtobufLogReader.WALHdrContext readHeader(org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.WALHeader.Builder builder, org.apache.hadoop.fs.FSDataInputStream stream) throws IOException
IOExceptionprivate String initInternal(org.apache.hadoop.fs.FSDataInputStream stream, boolean isFirst) throws IOException
IOExceptionprivate boolean setTrailerIfPresent()
In case the trailer size > this.trailerMaxSize, it is read after a WARN message.
IOExceptionprotected WALCellCodec getCodec(org.apache.hadoop.conf.Configuration conf, String cellCodecClsName, CompressionContext compressionContext) throws IOException
IOExceptionprotected void initAfterCompression() throws IOException
ReaderBaseinitAfterCompression in class ReaderBaseIOExceptionprotected void initAfterCompression(String cellCodecClsName) throws IOException
ReaderBaseinitAfterCompression in class ReaderBasecellCodecClsName - class name of cell CodecIOExceptionprotected boolean hasCompression()
hasCompression in class ReaderBaseprotected boolean hasTagCompression()
hasTagCompression in class ReaderBaseprotected boolean readNext(WAL.Entry entry) throws IOException
ReaderBasereadNext in class ReaderBaseentry - The entry to read into.IOExceptionprivate IOException extractHiddenEof(Exception ex)
protected void seekOnFs(long pos) throws IOException
ReaderBaseseekOnFs in class ReaderBaseIOExceptionCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.