@InterfaceAudience.Private @InterfaceStability.Evolving public class ReplicationSourceWALReader extends Thread
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ReplicationSourceWALReader.WALEntryBatch
Holds a batch of WAL entries to replicate, along with some statistics
|
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
private org.apache.hadoop.conf.Configuration |
conf |
private long |
currentPosition |
protected BlockingQueue<ReplicationSourceWALReader.WALEntryBatch> |
entryBatchQueue |
private boolean |
eofAutoRecovery |
private WALEntryFilter |
filter |
private org.apache.hadoop.fs.FileSystem |
fs |
private boolean |
isReaderRunning |
private static org.slf4j.Logger |
LOG |
private PriorityBlockingQueue<org.apache.hadoop.fs.Path> |
logQueue |
private int |
maxRetriesMultiplier |
protected int |
replicationBatchCountCapacity |
private long |
replicationBatchSizeCapacity |
private long |
sleepForRetries |
private ReplicationSource |
source |
private long |
totalBufferQuota |
private AtomicLong |
totalBufferUsed |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
ReplicationSourceWALReader(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.conf.Configuration conf,
PriorityBlockingQueue<org.apache.hadoop.fs.Path> logQueue,
long startPosition,
WALEntryFilter filter,
ReplicationSource source)
Creates a reader worker for a given WAL queue.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
acquireBufferQuota(long size) |
private int |
calculateTotalSizeOfStoreFiles(WALEdit edit)
Calculate the total size of all the store files
|
private boolean |
checkQuota() |
private Pair<Integer,Integer> |
countDistinctRowKeysAndHFiles(WALEdit edit)
Count the number of different row keys in the given edit because of mini-batching.
|
private WAL.Entry |
filterEntry(WAL.Entry entry) |
org.apache.hadoop.fs.Path |
getCurrentPath() |
private long |
getEntrySize(WAL.Entry entry) |
protected void |
handleEmptyWALEntryBatch(ReplicationSourceWALReader.WALEntryBatch batch,
org.apache.hadoop.fs.Path currentPath) |
private void |
handleEofException(IOException e) |
boolean |
isReaderRunning() |
private ReplicationSourceWALReader.WALEntryBatch |
readWALEntries(WALEntryStream entryStream) |
void |
run() |
void |
setReaderRunning(boolean readerRunning) |
ReplicationSourceWALReader.WALEntryBatch |
take()
Retrieves the next batch of WAL entries from the queue, waiting up to the specified time for a
batch to become available
|
private void |
updateBatchStats(ReplicationSourceWALReader.WALEntryBatch batch,
WAL.Entry entry,
long entryPosition,
long entrySize) |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
private static final org.slf4j.Logger LOG
private final PriorityBlockingQueue<org.apache.hadoop.fs.Path> logQueue
private final org.apache.hadoop.fs.FileSystem fs
private final org.apache.hadoop.conf.Configuration conf
private final WALEntryFilter filter
private final ReplicationSource source
protected final BlockingQueue<ReplicationSourceWALReader.WALEntryBatch> entryBatchQueue
private final long replicationBatchSizeCapacity
protected final int replicationBatchCountCapacity
private long currentPosition
private final long sleepForRetries
private final int maxRetriesMultiplier
private final boolean eofAutoRecovery
private boolean isReaderRunning
private AtomicLong totalBufferUsed
private long totalBufferQuota
public ReplicationSourceWALReader(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.conf.Configuration conf, PriorityBlockingQueue<org.apache.hadoop.fs.Path> logQueue, long startPosition, WALEntryFilter filter, ReplicationSource source)
fs
- the files system to useconf
- configuration to uselogQueue
- The WAL queue to read off ofstartPosition
- position in the first WAL to start reading fromfilter
- The filter to use while readingsource
- replication sourceprivate ReplicationSourceWALReader.WALEntryBatch readWALEntries(WALEntryStream entryStream) throws IOException
IOException
protected void handleEmptyWALEntryBatch(ReplicationSourceWALReader.WALEntryBatch batch, org.apache.hadoop.fs.Path currentPath) throws InterruptedException
InterruptedException
private void handleEofException(IOException e)
public org.apache.hadoop.fs.Path getCurrentPath()
private boolean checkQuota()
private WAL.Entry filterEntry(WAL.Entry entry)
public ReplicationSourceWALReader.WALEntryBatch take() throws InterruptedException
InterruptedException
- if interrupted while waitingprivate long getEntrySize(WAL.Entry entry)
private void updateBatchStats(ReplicationSourceWALReader.WALEntryBatch batch, WAL.Entry entry, long entryPosition, long entrySize)
private Pair<Integer,Integer> countDistinctRowKeysAndHFiles(WALEdit edit)
edit
- edit to count row keys fromprivate int calculateTotalSizeOfStoreFiles(WALEdit edit)
edit
- edit to count row keys fromprivate boolean acquireBufferQuota(long size)
size
- delta size for grown bufferpublic boolean isReaderRunning()
public void setReaderRunning(boolean readerRunning)
readerRunning
- the readerRunning to setCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.