@InterfaceAudience.Private public abstract class HBaseReplicationEndpoint extends BaseReplicationEndpoint implements Abortable
BaseReplicationEndpoint
for replication endpoints whose target cluster is an HBase
cluster.Modifier and Type | Class and Description |
---|---|
static class |
HBaseReplicationEndpoint.SinkPeer
Wraps a replication region server sink to provide the ability to identify it.
|
ReplicationEndpoint.Context, ReplicationEndpoint.ReplicateContext
Modifier and Type | Field and Description |
---|---|
private Map<ServerName,Integer> |
badReportCounts |
private int |
badSinkThreshold |
protected org.apache.hadoop.conf.Configuration |
conf |
private AsyncClusterConnection |
conn |
private Object |
connLock |
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.
|
static float |
DEFAULT_REPLICATION_SOURCE_RATIO
Default ratio of the total number of peer cluster region servers to consider replicating to.
|
private static org.slf4j.Logger |
LOG |
private float |
ratio |
private List<ServerName> |
sinkServers |
ctx, REPLICATION_WALENTRYFILTER_CONFIG_KEY
Constructor and Description |
---|
HBaseReplicationEndpoint() |
Modifier and Type | Method and Description |
---|---|
void |
abort(String why,
Throwable e)
Abort the server or client.
|
protected void |
chooseSinks() |
private AsyncClusterConnection |
connect() |
protected AsyncClusterConnection |
createConnection(org.apache.hadoop.conf.Configuration conf) |
private void |
disconnect() |
protected void |
doStart() |
protected void |
doStop() |
protected Collection<ServerName> |
fetchPeerAddresses()
Get the list of all the region servers from the specified peer
|
protected int |
getNumSinks() |
UUID |
getPeerUUID()
Returns a UUID of the provided peer id.
|
protected HBaseReplicationEndpoint.SinkPeer |
getReplicationSink()
Get a randomly-chosen replication sink to replicate to.
|
(package private) List<ServerName> |
getSinkServers() |
void |
init(ReplicationEndpoint.Context context)
Initialize the replication endpoint with the given context.
|
boolean |
isAborted()
Check if the server or client was aborted.
|
protected void |
reportBadSink(HBaseReplicationEndpoint.SinkPeer sinkPeer)
Report a
SinkPeer as being bad (i.e. |
protected void |
reportSinkSuccess(HBaseReplicationEndpoint.SinkPeer sinkPeer)
Report that a
SinkPeer successfully replicated a chunk of data. |
void |
start()
Initiates service startup and returns immediately.
|
void |
stop()
If the service is starting or running, this initiates service shutdown and returns immediately.
|
canReplicateToSameCluster, getNamespaceTableCfWALEntryFilter, getScopeWALEntryFilter, getWALEntryfilter, isStarting, peerConfigUpdated
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, doCancelStart, failureCause, isRunning, notifyFailed, notifyStarted, notifyStopped, startAsync, state, stopAsync, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, failureCause, isRunning, replicate
private static final org.slf4j.Logger LOG
protected org.apache.hadoop.conf.Configuration conf
private volatile AsyncClusterConnection conn
public static final int DEFAULT_BAD_SINK_THRESHOLD
public static final float DEFAULT_REPLICATION_SOURCE_RATIO
private float ratio
private int badSinkThreshold
private Map<ServerName,Integer> badReportCounts
private List<ServerName> sinkServers
public HBaseReplicationEndpoint()
protected AsyncClusterConnection createConnection(org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
public void init(ReplicationEndpoint.Context context) throws IOException
ReplicationEndpoint
init
in interface ReplicationEndpoint
init
in class BaseReplicationEndpoint
context
- replication contextIOException
- error occur when initialize the endpoint.private void disconnect()
public void start()
ReplicationEndpoint
start
in interface ReplicationEndpoint
public void stop()
ReplicationEndpoint
stop
in interface ReplicationEndpoint
protected void doStart()
doStart
in class org.apache.hbase.thirdparty.com.google.common.util.concurrent.AbstractService
protected void doStop()
doStop
in class org.apache.hbase.thirdparty.com.google.common.util.concurrent.AbstractService
public UUID getPeerUUID()
ReplicationEndpoint
getPeerUUID
in interface ReplicationEndpoint
private AsyncClusterConnection connect() throws IOException
IOException
public void abort(String why, Throwable e)
Abortable
public boolean isAborted()
Abortable
protected Collection<ServerName> fetchPeerAddresses()
protected void chooseSinks()
protected int getNumSinks()
protected HBaseReplicationEndpoint.SinkPeer getReplicationSink() throws IOException
IOException
protected void reportBadSink(HBaseReplicationEndpoint.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 itprotected void reportSinkSuccess(HBaseReplicationEndpoint.SinkPeer sinkPeer)
SinkPeer
successfully replicated a chunk of data. The SinkPeer that had a
failed replication attempt on itList<ServerName> getSinkServers()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.