@InterfaceAudience.Private public class ReplicationSource extends Thread implements ReplicationSourceInterface
A stream is considered down when we cannot contact a region server on the peer cluster for more than 55 seconds by default.
Modifier and Type | Class and Description |
---|---|
static class |
ReplicationSource.LogsComparator
Comparator used to compare logs together based on their start time
|
class |
ReplicationSource.ReplicationSourceWorkerThread |
static class |
ReplicationSource.WorkerState |
Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
ReplicationSource() |
Modifier and Type | Method and Description |
---|---|
private void |
decorateConf() |
void |
enqueueLog(org.apache.hadoop.fs.Path log)
Add a log to the list of logs to replicate
|
org.apache.hadoop.fs.Path |
getCurrentPath()
Get the current log that's replicated
|
String |
getPeerClusterId()
Get the id that the source is replicating to.
|
String |
getPeerClusterZnode()
Get the id that the source is replicating to
|
MetricsSource |
getSourceMetrics()
Get Replication Source Metrics
|
String |
getStats()
Get a string representation of the current statistics
for this source
|
void |
init(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
ReplicationSourceManager manager,
ReplicationQueues replicationQueues,
ReplicationPeers replicationPeers,
Stoppable stopper,
String peerClusterZnode,
UUID clusterId,
ReplicationEndpoint replicationEndpoint,
MetricsSource metrics)
Instantiation method used by region servers
|
protected boolean |
isPeerEnabled()
check whether the peer is enabled or not
|
private boolean |
isSourceActive() |
void |
run() |
protected boolean |
sleepForRetries(String msg,
int sleepMultiplier)
Do the sleeping logic
|
void |
startup()
Start the replication
|
void |
terminate(String reason)
End the replication
|
void |
terminate(String reason,
Exception cause)
End the replication
|
void |
terminate(String reason,
Exception cause,
boolean join) |
private void |
uninitialize() |
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.apache.commons.logging.Log LOG
private Map<String,PriorityBlockingQueue<org.apache.hadoop.fs.Path>> queues
private int queueSizePerGroup
private ReplicationQueues replicationQueues
private ReplicationPeers replicationPeers
private org.apache.hadoop.conf.Configuration conf
private ReplicationQueueInfo replicationQueueInfo
private String peerId
private ReplicationSourceManager manager
private Stoppable stopper
private long sleepForRetries
private long replicationQueueSizeCapacity
private int replicationQueueNbCapacity
private org.apache.hadoop.fs.FileSystem fs
private UUID clusterId
private UUID peerClusterId
private AtomicLong totalReplicatedEdits
private AtomicLong totalReplicatedOperations
private String peerClusterZnode
private int maxRetriesMultiplier
private volatile boolean sourceRunning
private MetricsSource metrics
private int logQueueWarnThreshold
private ReplicationEndpoint replicationEndpoint
private WALEntryFilter walEntryFilter
private ReplicationThrottler throttler
private AtomicInteger logQueueSize
private ConcurrentHashMap<String,ReplicationSource.ReplicationSourceWorkerThread> workerThreads
public void init(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, ReplicationSourceManager manager, ReplicationQueues replicationQueues, ReplicationPeers replicationPeers, Stoppable stopper, String peerClusterZnode, UUID clusterId, ReplicationEndpoint replicationEndpoint, MetricsSource metrics) throws IOException
init
in interface ReplicationSourceInterface
conf
- configuration to usefs
- file system to usemanager
- replication manager to ping tostopper
- the atomic boolean to use to stop the regionserverpeerClusterZnode
- the name of our znodeclusterId
- unique UUID for the clusterreplicationEndpoint
- the replication endpoint implementationmetrics
- metrics for replication sourceIOException
private void decorateConf()
public void enqueueLog(org.apache.hadoop.fs.Path log)
ReplicationSourceInterface
enqueueLog
in interface ReplicationSourceInterface
log
- path to the log to replicateprivate void uninitialize()
protected boolean sleepForRetries(String msg, int sleepMultiplier)
msg
- Why we sleepsleepMultiplier
- by how many times the default sleeping time is augmentedsleepMultiplier
is < maxRetriesMultiplier
protected boolean isPeerEnabled()
public void startup()
ReplicationSourceInterface
startup
in interface ReplicationSourceInterface
public void terminate(String reason)
ReplicationSourceInterface
terminate
in interface ReplicationSourceInterface
reason
- why it's terminatingpublic void terminate(String reason, Exception cause)
ReplicationSourceInterface
terminate
in interface ReplicationSourceInterface
reason
- why it's terminatingcause
- the error that's causing itpublic String getPeerClusterZnode()
ReplicationSourceInterface
getPeerClusterZnode
in interface ReplicationSourceInterface
public String getPeerClusterId()
ReplicationSourceInterface
getPeerClusterId
in interface ReplicationSourceInterface
public org.apache.hadoop.fs.Path getCurrentPath()
ReplicationSourceInterface
getCurrentPath
in interface ReplicationSourceInterface
private boolean isSourceActive()
public String getStats()
ReplicationSourceInterface
getStats
in interface ReplicationSourceInterface
public MetricsSource getSourceMetrics()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.