Class ReplicationSinkManager
java.lang.Object
org.apache.hadoop.hbase.replication.regionserver.ReplicationSinkManager
Maintains a collection of peers to replicate to, and randomly selects a single peer to replicate
to per set of data to replicate. Also handles keeping track of peer availability.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Wraps a replication region server sink to provide the ability to identify it. -
Field Summary
Modifier and TypeFieldDescriptionprivate final Map<ServerName,
Integer> private final int
private final Connection
(package private) static final int
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 final float
Default ratio of the total number of peer cluster region servers to consider replicating to.private final HBaseReplicationEndpoint
private long
private static final org.slf4j.Logger
private final String
private final Random
private final float
private List<ServerName>
-
Constructor Summary
ConstructorDescriptionReplicationSinkManager
(ClusterConnection conn, String peerClusterId, HBaseReplicationEndpoint endpoint, org.apache.hadoop.conf.Configuration conf) Instantiate for a single replication peer cluster. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Refresh the list of sinks.int
Get a randomly-chosen replication sink to replicate to.protected List<ServerName>
void
reportBadSink
(ReplicationSinkManager.SinkPeer sinkPeer) Report aSinkPeer
as being bad (i.e.void
Report that aSinkPeer
successfully replicated a chunk of data.
-
Field Details
-
LOG
-
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.- See Also:
-
DEFAULT_REPLICATION_SOURCE_RATIO
Default ratio of the total number of peer cluster region servers to consider replicating to.- See Also:
-
conn
-
peerClusterId
-
endpoint
-
badReportCounts
-
ratio
-
badSinkThreshold
-
random
-
lastUpdateToPeers
-
sinks
-
-
Constructor Details
-
ReplicationSinkManager
public ReplicationSinkManager(ClusterConnection conn, String peerClusterId, HBaseReplicationEndpoint endpoint, org.apache.hadoop.conf.Configuration conf) Instantiate for a single replication peer cluster.- Parameters:
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 threshold
-
-
Method Details
-
getReplicationSink
Get a randomly-chosen replication sink to replicate to.- Returns:
- a replication sink to replicate to
- Throws:
IOException
-
reportBadSink
Report aSinkPeer
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. The SinkPeer that had a failed replication attempt on it -
reportSinkSuccess
Report that aSinkPeer
successfully replicated a chunk of data. The SinkPeer that had a failed replication attempt on it -
chooseSinks
Refresh the list of sinks. -
getNumSinks
-
getSinksForTesting
-