@InterfaceAudience.Private public class ReplicationSource extends Object 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
|
| 限定符和类型 | 字段和说明 |
|---|---|
protected org.apache.hadoop.conf.Configuration |
conf |
static int |
DEFAULT_WAIT_ON_ENDPOINT_SECONDS |
protected org.apache.hadoop.fs.FileSystem |
fs |
protected ReplicationSourceManager |
manager |
protected String |
queueId |
protected int |
queueSizePerGroup |
protected ReplicationQueueStorage |
queueStorage |
protected ReplicationPeer |
replicationPeer |
protected ReplicationQueueInfo |
replicationQueueInfo |
protected Server |
server |
static String |
WAIT_ON_ENDPOINT_SECONDS |
protected WALEntryFilter |
walEntryFilter |
protected ConcurrentHashMap<String,ReplicationSourceShipper> |
workerThreads |
| 构造器和说明 |
|---|
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.
|
protected ReplicationSourceShipper |
createNewShipper(String walGroupId,
PriorityBlockingQueue<org.apache.hadoop.fs.Path> queue) |
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 |
getPeerId()
Get the id that the source is replicating to.
|
String |
getQueueId()
Get the queue id that the source is replicating to
|
ReplicationEndpoint |
getReplicationEndpoint() |
ServerName |
getServerWALsBelongTo()
The queue of WALs only belong to one region server.
|
ReplicationSourceManager |
getSourceManager() |
MetricsSource |
getSourceMetrics() |
String |
getStats()
Get a string representation of the current statistics
for this source
|
WALFileLengthProvider |
getWALFileLengthProvider() |
Map<String,ReplicationStatus> |
getWalGroupStatus()
get the stat of replication for each wal group.
|
void |
init(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
ReplicationSourceManager manager,
ReplicationQueueStorage queueStorage,
ReplicationPeer replicationPeer,
Server server,
String queueId,
UUID clusterId,
WALFileLengthProvider walFileLengthProvider,
MetricsSource metrics)
Instantiation method used by region servers
|
boolean |
isPeerEnabled()
check whether the peer is enabled or not
|
boolean |
isSourceActive() |
void |
postShipEdits(List<WAL.Entry> entries,
int batchSize)
Call this after the shipper thread ship some entries to peer cluster.
|
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) |
void |
tryThrottle(int batchSize)
Try to throttle when the peer config with a bandwidth
|
protected void |
uncaughtException(Thread t,
Throwable e) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisRecoveredprotected int queueSizePerGroup
protected ReplicationQueueStorage queueStorage
protected ReplicationPeer replicationPeer
protected org.apache.hadoop.conf.Configuration conf
protected ReplicationQueueInfo replicationQueueInfo
protected ReplicationSourceManager manager
protected Server server
protected org.apache.hadoop.fs.FileSystem fs
protected String queueId
protected volatile WALEntryFilter walEntryFilter
protected final ConcurrentHashMap<String,ReplicationSourceShipper> workerThreads
public static final int DEFAULT_WAIT_ON_ENDPOINT_SECONDS
public void init(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
ReplicationSourceManager manager,
ReplicationQueueStorage queueStorage,
ReplicationPeer replicationPeer,
Server server,
String queueId,
UUID clusterId,
WALFileLengthProvider walFileLengthProvider,
MetricsSource metrics)
throws IOException
init 在接口中 ReplicationSourceInterfaceconf - configuration to usefs - file system to usemanager - replication manager to ping toserver - the server for this region serverqueueId - the id of our replication queueclusterId - unique UUID for the clustermetrics - 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 referencespublic Map<String,ReplicationStatus> getWalGroupStatus()
ReplicationSourceInterfacegetWalGroupStatus 在接口中 ReplicationSourceInterfaceprotected ReplicationSourceShipper createNewShipper(String walGroupId, PriorityBlockingQueue<org.apache.hadoop.fs.Path> queue)
public ReplicationEndpoint getReplicationEndpoint()
getReplicationEndpoint 在接口中 ReplicationSourceInterfacepublic ReplicationSourceManager getSourceManager()
getSourceManager 在接口中 ReplicationSourceInterfacepublic void tryThrottle(int batchSize)
throws InterruptedException
ReplicationSourceInterfacetryThrottle 在接口中 ReplicationSourceInterfacebatchSize - entries size will be pushedInterruptedExceptionprotected boolean sleepForRetries(String msg, int sleepMultiplier)
msg - Why we sleepsleepMultiplier - by how many times the default sleeping time is augmentedsleepMultiplier is < maxRetriesMultiplierpublic boolean isPeerEnabled()
isPeerEnabled 在接口中 ReplicationSourceInterfacepublic 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 getQueueId()
ReplicationSourceInterfacegetQueueId 在接口中 ReplicationSourceInterfacepublic String getPeerId()
ReplicationSourceInterfacegetPeerId 在接口中 ReplicationSourceInterfacepublic org.apache.hadoop.fs.Path getCurrentPath()
ReplicationSourceInterfacegetCurrentPath 在接口中 ReplicationSourceInterfacepublic boolean isSourceActive()
isSourceActive 在接口中 ReplicationSourceInterfacepublic String getStats()
ReplicationSourceInterfacegetStats 在接口中 ReplicationSourceInterfacepublic MetricsSource getSourceMetrics()
getSourceMetrics 在接口中 ReplicationSourceInterfacepublic void postShipEdits(List<WAL.Entry> entries, int batchSize)
ReplicationSourceInterfacepostShipEdits 在接口中 ReplicationSourceInterfaceentries - pushedbatchSize - entries size pushedpublic WALFileLengthProvider getWALFileLengthProvider()
getWALFileLengthProvider 在接口中 ReplicationSourceInterfacepublic ServerName getServerWALsBelongTo()
ReplicationSourceInterfacegetServerWALsBelongTo 在接口中 ReplicationSourceInterfaceCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.