protected static class WALEntryStreamTestBase.WALEntryStreamWithRetries extends Object
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.Modifier and Type | Class and Description |
---|---|
static class |
org.apache.hadoop.hbase.replication.regionserver.WALEntryStream.HasNext |
Modifier and Type | Field and Description |
---|---|
private boolean |
retry |
Constructor and 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) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
disableRetry() |
void |
enableRetry() |
org.apache.hadoop.fs.Path |
getCurrentPath() |
long |
getPosition() |
org.apache.hadoop.hbase.replication.regionserver.WALEntryStream.HasNext |
hasNext() |
org.apache.hadoop.hbase.wal.WAL.Entry |
next() |
org.apache.hadoop.hbase.wal.WAL.Entry |
peek() |
private boolean retry
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)
public void enableRetry()
public void disableRetry()
public org.apache.hadoop.hbase.replication.regionserver.WALEntryStream.HasNext hasNext()
public org.apache.hadoop.hbase.wal.WAL.Entry peek()
public org.apache.hadoop.hbase.wal.WAL.Entry next()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public long getPosition()
public org.apache.hadoop.fs.Path getCurrentPath()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.