public class ReplicationSource.ReplicationSourceWorkerThread extends Thread
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
private int |
currentNbOperations |
private org.apache.hadoop.fs.Path |
currentPath |
private int |
currentSize |
private long |
lastLoggedPosition |
private PriorityBlockingQueue<org.apache.hadoop.fs.Path> |
queue |
private WAL.Reader |
reader |
private ReplicationQueueInfo |
replicationQueueInfo |
private ReplicationWALReaderManager |
repLogReader |
private ReplicationSource |
source |
private ReplicationSource.WorkerState |
state |
private String |
walGroupId |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
ReplicationSource.ReplicationSourceWorkerThread(String walGroupId,
PriorityBlockingQueue<org.apache.hadoop.fs.Path> queue,
ReplicationQueueInfo replicationQueueInfo,
ReplicationSource source) |
Modifier and Type | Method and Description |
---|---|
private int |
countDistinctRowKeys(WALEdit edit)
Count the number of different row keys in the given edit because of mini-batching.
|
org.apache.hadoop.fs.Path |
getCurrentPath() |
long |
getCurrentPosition() |
protected boolean |
getNextPath()
Poll for the next path
|
ReplicationSource.WorkerState |
getWorkerState()
Get the current state of this worker.
|
private boolean |
isCurrentLogEmpty() |
private boolean |
isWorkerActive() |
protected boolean |
openReader(int sleepMultiplier)
Open a reader on the current path
|
protected boolean |
processEndOfFile(boolean dumpOnlyIfZeroLength)
If the queue isn't empty, switch to the next one Else if this is a recovered queue, it means
we're done! Else we'll just continue to try reading the log file
|
protected boolean |
readAllEntriesToReplicateOrNextFile(boolean currentWALisBeingWrittenTo,
List<WAL.Entry> entries)
Read all the entries from the current log files and retain those that need to be replicated.
|
private void |
recoverLease(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path path) |
void |
run() |
void |
setWorkerState(ReplicationSource.WorkerState state)
Set the worker state
|
protected void |
shipEdits(boolean currentWALisBeingWrittenTo,
List<WAL.Entry> entries)
Do the shipping logic
|
void |
startup() |
private void |
terminate(String reason,
Exception cause) |
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 ReplicationSource source
private String walGroupId
private PriorityBlockingQueue<org.apache.hadoop.fs.Path> queue
private ReplicationQueueInfo replicationQueueInfo
private WAL.Reader reader
private long lastLoggedPosition
private volatile org.apache.hadoop.fs.Path currentPath
private ReplicationWALReaderManager repLogReader
private int currentNbOperations
private int currentSize
private ReplicationSource.WorkerState state
public ReplicationSource.ReplicationSourceWorkerThread(String walGroupId, PriorityBlockingQueue<org.apache.hadoop.fs.Path> queue, ReplicationQueueInfo replicationQueueInfo, ReplicationSource source)
protected boolean readAllEntriesToReplicateOrNextFile(boolean currentWALisBeingWrittenTo, List<WAL.Entry> entries) throws IOException
currentWALisBeingWrittenTo
- is the current WAL being written toentries
- resulting entries to be replicatedIOException
protected boolean getNextPath()
protected boolean openReader(int sleepMultiplier)
sleepMultiplier
- by how many times the default sleeping time is augmentedprivate void recoverLease(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path path)
private boolean isCurrentLogEmpty()
private int countDistinctRowKeys(WALEdit edit)
edit
- edit to count row keys fromprotected void shipEdits(boolean currentWALisBeingWrittenTo, List<WAL.Entry> entries)
currentWALisBeingWrittenTo
- was the current WAL being (seemingly)
written to when this method was calledprotected boolean processEndOfFile(boolean dumpOnlyIfZeroLength)
public void startup()
public org.apache.hadoop.fs.Path getCurrentPath()
public long getCurrentPosition()
private boolean isWorkerActive()
public void setWorkerState(ReplicationSource.WorkerState state)
state
- public ReplicationSource.WorkerState getWorkerState()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.