Class HBaseReplicationEndpoint
java.lang.Object
org.apache.hbase.thirdparty.com.google.common.util.concurrent.AbstractService
org.apache.hadoop.hbase.replication.BaseReplicationEndpoint
org.apache.hadoop.hbase.replication.HBaseReplicationEndpoint
- All Implemented Interfaces:
Abortable
,ReplicationEndpoint
,ReplicationPeerConfigListener
,org.apache.hbase.thirdparty.com.google.common.util.concurrent.Service
- Direct Known Subclasses:
HBaseInterClusterReplicationEndpoint
@Private
public abstract class HBaseReplicationEndpoint
extends BaseReplicationEndpoint
implements Abortable
A
BaseReplicationEndpoint
for replication endpoints whose target cluster is an HBase
cluster.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Wraps a replication region server sink to provide the ability to identify it.Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.replication.ReplicationEndpoint
ReplicationEndpoint.Context, ReplicationEndpoint.ReplicateContext
Nested classes/interfaces inherited from interface org.apache.hbase.thirdparty.com.google.common.util.concurrent.Service
org.apache.hbase.thirdparty.com.google.common.util.concurrent.Service.Listener, org.apache.hbase.thirdparty.com.google.common.util.concurrent.Service.State
-
Field Summary
Modifier and TypeFieldDescriptionprivate Map<ServerName,
Integer> private int
private URI
protected org.apache.hadoop.conf.Configuration
private AsyncClusterConnection
private final Object
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.static final float
Default ratio of the total number of peer cluster region servers to consider replicating to.private static final org.slf4j.Logger
private float
private List<ServerName>
Fields inherited from class org.apache.hadoop.hbase.replication.BaseReplicationEndpoint
ctx, REPLICATION_WALENTRYFILTER_CONFIG_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Abort the server or client.protected void
private AsyncClusterConnection
connect()
protected AsyncClusterConnection
createConnection
(URI clusterURI, org.apache.hadoop.conf.Configuration conf) Some implementations of HBaseInterClusterReplicationEndpoint may require instantiate different Connection implementations, or initialize it in a different way, so defining createConnection as protected for possible overridings.private void
protected void
doStart()
protected void
doStop()
protected Collection<ServerName>
Get the list of all the region servers from the specified peerprotected int
Returns a UUID of the provided peer id.protected HBaseReplicationEndpoint.SinkPeer
Get a randomly-chosen replication sink to replicate to.(package private) List<ServerName>
void
init
(ReplicationEndpoint.Context context) Initialize the replication endpoint with the given context.boolean
Check if the server or client was aborted.protected void
Report aSinkPeer
as being bad (i.e.protected void
Report that aSinkPeer
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.Methods inherited from class org.apache.hadoop.hbase.replication.BaseReplicationEndpoint
canReplicateToSameCluster, getNamespaceTableCfWALEntryFilter, getScopeWALEntryFilter, getWALEntryfilter, isStarting, peerConfigUpdated
Methods inherited from class org.apache.hbase.thirdparty.com.google.common.util.concurrent.AbstractService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, doCancelStart, failureCause, isRunning, notifyFailed, notifyStarted, notifyStopped, startAsync, state, stopAsync, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.hadoop.hbase.replication.ReplicationEndpoint
awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, failureCause, isRunning, replicate
-
Field Details
-
LOG
-
conf
-
clusterURI
-
connLock
-
conn
-
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:
-
ratio
-
badSinkThreshold
-
badReportCounts
-
sinkServers
-
-
Constructor Details
-
HBaseReplicationEndpoint
public HBaseReplicationEndpoint()
-
-
Method Details
-
createConnection
protected AsyncClusterConnection createConnection(URI clusterURI, org.apache.hadoop.conf.Configuration conf) throws IOException Some implementations of HBaseInterClusterReplicationEndpoint may require instantiate different Connection implementations, or initialize it in a different way, so defining createConnection as protected for possible overridings.- Throws:
IOException
-
init
Description copied from interface:ReplicationEndpoint
Initialize the replication endpoint with the given context.- Specified by:
init
in interfaceReplicationEndpoint
- Overrides:
init
in classBaseReplicationEndpoint
- Parameters:
context
- replication context- Throws:
IOException
- error occur when initialize the endpoint.
-
disconnect
-
start
Description copied from interface:ReplicationEndpoint
Initiates service startup and returns immediately. A stopped service may not be restarted. Equivalent of startAsync call in Guava Service.- Specified by:
start
in interfaceReplicationEndpoint
-
stop
Description copied from interface:ReplicationEndpoint
If the service is starting or running, this initiates service shutdown and returns immediately. If the service has already been stopped, this method returns immediately without taking action. Equivalent of stopAsync call in Guava Service.- Specified by:
stop
in interfaceReplicationEndpoint
-
doStart
- Specified by:
doStart
in classorg.apache.hbase.thirdparty.com.google.common.util.concurrent.AbstractService
-
doStop
- Specified by:
doStop
in classorg.apache.hbase.thirdparty.com.google.common.util.concurrent.AbstractService
-
getPeerUUID
Description copied from interface:ReplicationEndpoint
Returns a UUID of the provided peer id. Every HBase cluster instance has a persisted associated UUID. If the replication is not performed to an actual HBase cluster (but some other system), the UUID returned has to uniquely identify the connected target system.- Specified by:
getPeerUUID
in interfaceReplicationEndpoint
- Returns:
- a UUID or null if the peer cluster does not exist or is not connected.
-
connect
- Throws:
IOException
-
abort
Description copied from interface:Abortable
Abort the server or client. -
isAborted
Description copied from interface:Abortable
Check if the server or client was aborted. -
fetchPeerAddresses
Get the list of all the region servers from the specified peer- Returns:
- list of region server addresses or an empty list if the slave is unavailable
-
chooseSinks
-
getNumSinks
-
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.- Parameters:
sinkPeer
- 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 -
getSinkServers
-