@InterfaceAudience.Private public class ReplicationSinkManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ReplicationSinkManager.SinkPeer
Wraps a replication region server sink to provide the ability to identify
it.
|
Modifier and Type | Field and Description |
---|---|
private Map<ServerName,Integer> |
badReportCounts |
private int |
badSinkThreshold |
private Connection |
conn |
(package private) static int |
DEFAULT_BAD_SINK_THRESHOLD
Default maximum number of times a replication sink can be reported as bad before
it will no longer be provided as a sink for replication without the pool of
replication sinks being refreshed.
|
(package private) static float |
DEFAULT_REPLICATION_SOURCE_RATIO
Default ratio of the total number of peer cluster region servers to consider
replicating to.
|
private HBaseReplicationEndpoint |
endpoint |
private long |
lastUpdateToPeers |
private static org.slf4j.Logger |
LOG |
private String |
peerClusterId |
private Random |
random |
private float |
ratio |
private List<ServerName> |
sinks |
Constructor and Description |
---|
ReplicationSinkManager(ClusterConnection conn,
String peerClusterId,
HBaseReplicationEndpoint endpoint,
org.apache.hadoop.conf.Configuration conf)
Instantiate for a single replication peer cluster.
|
Modifier and Type | Method and Description |
---|---|
void |
chooseSinks()
Refresh the list of sinks.
|
int |
getNumSinks() |
ReplicationSinkManager.SinkPeer |
getReplicationSink()
Get a randomly-chosen replication sink to replicate to.
|
protected List<ServerName> |
getSinksForTesting() |
void |
reportBadSink(ReplicationSinkManager.SinkPeer sinkPeer)
Report a
SinkPeer as being bad (i.e. |
void |
reportSinkSuccess(ReplicationSinkManager.SinkPeer sinkPeer)
Report that a
SinkPeer successfully replicated a chunk of data. |
private static final org.slf4j.Logger LOG
static final int DEFAULT_BAD_SINK_THRESHOLD
static final float DEFAULT_REPLICATION_SOURCE_RATIO
private final Connection conn
private final String peerClusterId
private final HBaseReplicationEndpoint endpoint
private final Map<ServerName,Integer> badReportCounts
private final float ratio
private final int badSinkThreshold
private long lastUpdateToPeers
private List<ServerName> sinks
public ReplicationSinkManager(ClusterConnection conn, String peerClusterId, HBaseReplicationEndpoint endpoint, org.apache.hadoop.conf.Configuration conf)
conn
- connection to the peer clusterpeerClusterId
- identifier of the peer clusterendpoint
- replication endpoint for inter cluster replicationconf
- HBase configuration, used for determining replication source ratio and bad peer
thresholdpublic ReplicationSinkManager.SinkPeer getReplicationSink() throws IOException
IOException
public void reportBadSink(ReplicationSinkManager.SinkPeer sinkPeer)
SinkPeer
as being bad (i.e. an attempt to replicate to it
failed). If a single SinkPeer is reported as bad more than
replication.bad.sink.threshold times, it will be removed
from the pool of potential replication targets.sinkPeer
- The SinkPeer that had a failed replication attempt on itpublic void reportSinkSuccess(ReplicationSinkManager.SinkPeer sinkPeer)
SinkPeer
successfully replicated a chunk of data.sinkPeer
- The SinkPeer that had a failed replication attempt on itpublic void chooseSinks()
public int getNumSinks()
protected List<ServerName> getSinksForTesting()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.