@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.
| 限定符和类型 | 类和说明 |
|---|---|
static class |
ReplicationSource.LogsComparator
Comparator used to compare logs together based on their start time
|
class |
ReplicationSource.ReplicationSourceShipperThread |
static class |
ReplicationSource.WorkerState |
Thread.State, Thread.UncaughtExceptionHandlerMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| 构造器和说明 |
|---|
ReplicationSource() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addHFileRefs(TableName tableName,
byte[] family,
List<Pair<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.Path>> pairs)
Add hfile names to the queue to be replicated.
|
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
|
org.apache.hadoop.fs.Path |
getLastLoggedPath() |
long |
getLastLoggedPosition() |
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 the associated 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
|
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) |
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, yieldpublic 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 在接口中 ReplicationSourceInterfaceconf - 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 sourceIOExceptionpublic void enqueueLog(org.apache.hadoop.fs.Path log)
ReplicationSourceInterfaceenqueueLog 在接口中 ReplicationSourceInterfacelog - path to the log to replicatepublic void addHFileRefs(TableName tableName, byte[] family, List<Pair<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.Path>> pairs) throws ReplicationException
ReplicationSourceInterfaceaddHFileRefs 在接口中 ReplicationSourceInterfacetableName - Name of the table these files belongs tofamily - Name of the family these files belong topairs - list of pairs of { HFile location in staging dir, HFile path in region dir which
will be added in the queue for replication}ReplicationException - If failed to add hfile referencesprotected boolean sleepForRetries(String msg, int sleepMultiplier)
msg - Why we sleepsleepMultiplier - by how many times the default sleeping time is augmentedsleepMultiplier is < maxRetriesMultiplierprotected boolean isPeerEnabled()
public void startup()
ReplicationSourceInterfacestartup 在接口中 ReplicationSourceInterfacepublic void terminate(String reason)
ReplicationSourceInterfaceterminate 在接口中 ReplicationSourceInterfacereason - why it's terminatingpublic void terminate(String reason, Exception cause)
ReplicationSourceInterfaceterminate 在接口中 ReplicationSourceInterfacereason - why it's terminatingcause - the error that's causing itpublic String getPeerClusterZnode()
ReplicationSourceInterfacegetPeerClusterZnode 在接口中 ReplicationSourceInterfacepublic String getPeerClusterId()
ReplicationSourceInterfacegetPeerClusterId 在接口中 ReplicationSourceInterfacepublic org.apache.hadoop.fs.Path getCurrentPath()
ReplicationSourceInterfacegetCurrentPath 在接口中 ReplicationSourceInterfacepublic org.apache.hadoop.fs.Path getLastLoggedPath()
public long getLastLoggedPosition()
public String getStats()
ReplicationSourceInterfacegetStats 在接口中 ReplicationSourceInterfacepublic MetricsSource getSourceMetrics()
ReplicationSourceInterfacegetSourceMetrics 在接口中 ReplicationSourceInterfaceCopyright © 2007–2021 The Apache Software Foundation. All rights reserved.