org.apache.hadoop.hbase.regionserver.wal
Class ReaderBase

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.wal.ReaderBase
All Implemented Interfaces:
HLog.Reader
Direct Known Subclasses:
ProtobufLogReader, SequenceFileLogReader

@InterfaceAudience.LimitedPrivate(value={"Coprocesssor","Phoenix"})
public abstract class ReaderBase
extends Object
implements HLog.Reader


Field Summary
protected  org.apache.hadoop.hbase.regionserver.wal.CompressionContext compressionContext
          Compression context to use reading.
protected  org.apache.hadoop.conf.Configuration conf
           
protected  long edit
           
protected  boolean emptyCompressionContext
           
protected  long fileLength
           
protected  org.apache.hadoop.fs.FileSystem fs
           
protected  org.apache.hadoop.fs.Path path
           
protected  WALProtos.WALTrailer trailer
           
protected  int trailerWarnSize
           
 
Constructor Summary
ReaderBase()
          Default constructor.
 
Method Summary
 WALProtos.WALTrailer getWALTrailer()
           
protected abstract  boolean hasCompression()
           
protected abstract  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 abstract  void initAfterCompression()
          Initializes the compression after the shared stuff has been initialized.
protected abstract  void initAfterCompression(String cellCodecClsName)
          Initializes the compression after the shared stuff has been initialized.
protected abstract  String initReader(org.apache.hadoop.fs.FSDataInputStream stream)
          Initializes the log reader with a particular stream (may be null).
 HLog.Entry next()
           
 HLog.Entry next(HLog.Entry reuse)
           
protected abstract  boolean readNext(HLog.Entry e)
          Read next entry.
 void seek(long pos)
           
protected abstract  void seekOnFs(long pos)
          Performs a filesystem-level seek to a certain position in an underlying file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.hbase.regionserver.wal.HLog.Reader
close, getPosition, reset
 

Field Detail

conf

protected org.apache.hadoop.conf.Configuration conf

fs

protected org.apache.hadoop.fs.FileSystem fs

path

protected org.apache.hadoop.fs.Path path

edit

protected long edit

fileLength

protected long fileLength

trailer

protected WALProtos.WALTrailer trailer

trailerWarnSize

protected int trailerWarnSize

compressionContext

protected org.apache.hadoop.hbase.regionserver.wal.CompressionContext compressionContext
Compression context to use reading. Can be null if no compression.


emptyCompressionContext

protected boolean emptyCompressionContext
Constructor Detail

ReaderBase

public ReaderBase()
Default constructor.

Method Detail

init

public 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
Specified by:
init in interface HLog.Reader
Parameters:
fs - File system.
path - Path.
conf - Configuration.
stream - Input stream that may have been pre-opened by the caller; may be null.
Throws:
IOException

next

public HLog.Entry next()
                throws IOException
Specified by:
next in interface HLog.Reader
Throws:
IOException

next

public HLog.Entry next(HLog.Entry reuse)
                throws IOException
Specified by:
next in interface HLog.Reader
Throws:
IOException

seek

public void seek(long pos)
          throws IOException
Specified by:
seek in interface HLog.Reader
Throws:
IOException

initReader

protected abstract String initReader(org.apache.hadoop.fs.FSDataInputStream stream)
                              throws IOException
Initializes the log reader with a particular stream (may be null). Reader assumes ownership of the stream if not null and may use it. Called once.

Returns:
the class name of cell Codec, null if such information is not available
Throws:
IOException

initAfterCompression

protected abstract void initAfterCompression()
                                      throws IOException
Initializes the compression after the shared stuff has been initialized. Called once.

Throws:
IOException

initAfterCompression

protected abstract void initAfterCompression(String cellCodecClsName)
                                      throws IOException
Initializes the compression after the shared stuff has been initialized. Called once.

Parameters:
cellCodecClsName - class name of cell Codec
Throws:
IOException

hasCompression

protected abstract boolean hasCompression()
Returns:
Whether compression is enabled for this log.

hasTagCompression

protected abstract boolean hasTagCompression()
Returns:
Whether tag compression is enabled for this log.

readNext

protected abstract boolean readNext(HLog.Entry e)
                             throws IOException
Read next entry.

Parameters:
e - The entry to read into.
Returns:
Whether there was anything to read.
Throws:
IOException

seekOnFs

protected abstract void seekOnFs(long pos)
                          throws IOException
Performs a filesystem-level seek to a certain position in an underlying file.

Throws:
IOException

getWALTrailer

public WALProtos.WALTrailer getWALTrailer()
Specified by:
getWALTrailer in interface HLog.Reader
Returns:
the WALTrailer of the current HLog. It may be null in case of legacy or corrupt WAL files.


Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.