Class WALEntryStreamTestBase.WALEntryStreamWithRetries

java.lang.Object
org.apache.hadoop.hbase.replication.regionserver.WALEntryStreamTestBase.WALEntryStreamWithRetries
All Implemented Interfaces:
Closeable, AutoCloseable
Enclosing class:
WALEntryStreamTestBase

Test helper that waits until a non-null entry is available in the stream next or times out. A WALEntryStream provides a streaming access to a queue of log files. Since the stream can be consumed as the file is being written, callers relying on WALEntryStream.next() may need to retry multiple times before an entry appended to the WAL is visible to the stream consumers. One such cause of delay is the close() of writer writing these log files. While the closure is in progress, the stream does not switch to the next log in the queue and next() may return null entries. This utility wraps these retries into a single next call and that makes the test code simpler.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    org.apache.hadoop.hbase.replication.regionserver.WALEntryStream.HasNext
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    WALEntryStreamWithRetries(org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceLogQueue logQueue, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.conf.Configuration conf, long startPosition, org.apache.hadoop.hbase.replication.regionserver.WALFileLengthProvider walFileLengthProvider, org.apache.hadoop.hbase.replication.regionserver.MetricsSource metrics, String walGroupId)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
     
    void
     
    org.apache.hadoop.fs.Path
     
    long
     
    org.apache.hadoop.hbase.replication.regionserver.WALEntryStream.HasNext
     
    org.apache.hadoop.hbase.wal.WAL.Entry
     
    org.apache.hadoop.hbase.wal.WAL.Entry
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • retry

      private boolean retry
  • Constructor Details

    • WALEntryStreamWithRetries

      public WALEntryStreamWithRetries(org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceLogQueue logQueue, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.conf.Configuration conf, long startPosition, org.apache.hadoop.hbase.replication.regionserver.WALFileLengthProvider walFileLengthProvider, org.apache.hadoop.hbase.replication.regionserver.MetricsSource metrics, String walGroupId)
  • Method Details

    • enableRetry

      public void enableRetry()
    • disableRetry

      public void disableRetry()
    • hasNext

      public org.apache.hadoop.hbase.replication.regionserver.WALEntryStream.HasNext hasNext()
    • peek

      public org.apache.hadoop.hbase.wal.WAL.Entry peek()
    • next

      public org.apache.hadoop.hbase.wal.WAL.Entry next()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • getPosition

      public long getPosition()
    • getCurrentPath

      public org.apache.hadoop.fs.Path getCurrentPath()