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
Nested ClassesModifier and TypeClassDescriptionstatic classWraps 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.ReplicateContextNested 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
FieldsModifier and TypeFieldDescriptionprivate Map<ServerName,Integer> private intprivate URIprotected org.apache.hadoop.conf.Configurationprivate AsyncClusterConnectionprivate final Objectstatic final intDefault 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 floatDefault ratio of the total number of peer cluster region servers to consider replicating to.private static final org.slf4j.Loggerprivate floatprivate List<ServerName>Fields inherited from class org.apache.hadoop.hbase.replication.BaseReplicationEndpoint
ctx, REPLICATION_WALENTRYFILTER_CONFIG_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAbort the server or client.protected voidprivate AsyncClusterConnectionconnect()protected AsyncClusterConnectioncreateConnection(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 voidprotected voiddoStart()protected voiddoStop()protected Collection<ServerName>Get the list of all the region servers from the specified peerprotected intReturns a UUID of the provided peer id.protected HBaseReplicationEndpoint.SinkPeerGet a randomly-chosen replication sink to replicate to.(package private) List<ServerName>voidinit(ReplicationEndpoint.Context context) Initialize the replication endpoint with the given context.booleanCheck if the server or client was aborted.protected voidReport aSinkPeeras being bad (i.e.protected voidReport that aSinkPeersuccessfully replicated a chunk of data.voidstart()Initiates service startup and returns immediately.voidstop()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, peerConfigUpdatedMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:ReplicationEndpointInitialize the replication endpoint with the given context.- Specified by:
initin interfaceReplicationEndpoint- Overrides:
initin classBaseReplicationEndpoint- Parameters:
context- replication context- Throws:
IOException- error occur when initialize the endpoint.
-
disconnect
-
start
Description copied from interface:ReplicationEndpointInitiates service startup and returns immediately. A stopped service may not be restarted. Equivalent of startAsync call in Guava Service.- Specified by:
startin interfaceReplicationEndpoint
-
stop
Description copied from interface:ReplicationEndpointIf 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:
stopin interfaceReplicationEndpoint
-
doStart
- Specified by:
doStartin classorg.apache.hbase.thirdparty.com.google.common.util.concurrent.AbstractService
-
doStop
- Specified by:
doStopin classorg.apache.hbase.thirdparty.com.google.common.util.concurrent.AbstractService
-
getPeerUUID
Description copied from interface:ReplicationEndpointReturns 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:
getPeerUUIDin 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:AbortableAbort the server or client. -
isAborted
Description copied from interface:AbortableCheck 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 aSinkPeeras 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 aSinkPeersuccessfully replicated a chunk of data. The SinkPeer that had a failed replication attempt on it -
getSinkServers
-