Class ReplicationSourceShipper
java.lang.Object
java.lang.Thread
org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceShipper
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
RecoveredReplicationSourceShipper
This thread reads entries from a queue and ships them. Entries are placed onto the queue by
ReplicationSourceWALReaderThread
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Modifier and TypeFieldDescriptionprivate final org.apache.hadoop.conf.Configuration
private org.apache.hadoop.fs.Path
private long
private final int
protected ReplicationSourceWALReader
private final int
private static final org.slf4j.Logger
protected final ReplicationSourceLogQueue
protected final int
private final int
protected final long
private final ReplicationSource
protected final String
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorDescriptionReplicationSourceShipper
(org.apache.hadoop.conf.Configuration conf, String walGroupId, ReplicationSourceLogQueue logQueue, ReplicationSource source) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
cleanUpHFileRefs
(WALEdit edit) (package private) void
Attempts to properly updateReplicationSourceManager.totalBufferUser
, in case there were unprocessed entries batched by the reader to the shipper, but the shipper didn't manage to ship those because the replication source is being terminated.(package private) org.apache.hadoop.fs.Path
(package private) long
(package private) long
protected boolean
isActive()
boolean
protected void
protected void
final void
run()
(package private) void
setWALReader
(ReplicationSourceWALReader entryReader) protected final void
private void
shipEdits
(WALEntryBatch entryBatch) Do the shipping logicboolean
sleepForRetries
(String msg, int sleepMultiplier) Do the sleeping logicvoid
startup
(Thread.UncaughtExceptionHandler handler) (package private) void
private boolean
updateLogPosition
(WALEntryBatch batch) Methods inherited from class java.lang.Thread
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
-
Field Details
-
LOG
-
conf
-
walGroupId
-
logQueue
-
source
-
currentPosition
-
currentPath
-
state
-
entryReader
-
sleepForRetries
-
maxRetriesMultiplier
-
DEFAULT_TIMEOUT
- See Also:
-
getEntriesTimeout
-
shipEditsTimeout
-
-
Constructor Details
-
ReplicationSourceShipper
public ReplicationSourceShipper(org.apache.hadoop.conf.Configuration conf, String walGroupId, ReplicationSourceLogQueue logQueue, ReplicationSource source)
-
-
Method Details
-
run
-
noMoreData
-
postFinish
-
shipEdits
Do the shipping logic -
cleanUpHFileRefs
- Throws:
IOException
-
updateLogPosition
-
startup
-
getCurrentPath
org.apache.hadoop.fs.Path getCurrentPath() -
getCurrentPosition
long getCurrentPosition() -
setWALReader
-
getStartPosition
long getStartPosition() -
isActive
-
setWorkerState
-
stopWorker
void stopWorker() -
isFinished
-
sleepForRetries
Do the sleeping logic- Parameters:
msg
- Why we sleepsleepMultiplier
- by how many times the default sleeping time is augmented- Returns:
- True if
sleepMultiplier
is <maxRetriesMultiplier
-
clearWALEntryBatch
void clearWALEntryBatch()Attempts to properly updateReplicationSourceManager.totalBufferUser
, in case there were unprocessed entries batched by the reader to the shipper, but the shipper didn't manage to ship those because the replication source is being terminated. In that case, it iterates through the batched entries and decrease the pending entries size fromReplicationSourceManager.totalBufferUser
NOTES 1) This method should only be called upon replication source termination. It blocks waiting for both shipper and reader threads termination, to make sure no race conditions when updatingReplicationSourceManager.totalBufferUser
. 2) It does not attempt to terminate reader and shipper threads. Those must have been triggered interruption/termination prior to calling this method.
-