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,RegionReplicaReplicationEndpoint
@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 classTracks changes to the list of region servers in a peer's cluster.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 longprivate static final org.slf4j.Loggerprivate List<ServerName>private ZKWatcherFields 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 voidprotected voiddoStart()protected voiddoStop()protected static List<ServerName>Get the list of all the region servers from the specified peerlongGet the timestamp at which the last change occurred to the list of region servers to replicate to.Returns a UUID of the provided peer id.Get a list of all the addresses of all the available region servers for this peer cluster, or an empty list if no region servers available at peer cluster.protected ZKWatchergetZkw()Get the ZK connection to this peerbooleanCheck if the server or client was aborted.protected voidreconnect(org.apache.zookeeper.KeeperException ke) A private method used to re-establish a zookeeper session with a peer cluster.(package private) voidCloses the current ZKW (if not null) and creates a new onevoidsetRegionServers(List<ServerName> regionServers) Set the list of region servers for that peervoidstart()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, init, 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
-
zkw
-
regionServers
-
lastRegionServerUpdate
-
-
Constructor Details
-
HBaseReplicationEndpoint
public HBaseReplicationEndpoint()
-
-
Method Details
-
disconnect
-
reconnect
A private method used to re-establish a zookeeper session with a peer cluster. -
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.
-
getZkw
Get the ZK connection to this peer- Returns:
- zk connection
-
reloadZkWatcher
Closes the current ZKW (if not null) and creates a new one- Throws:
IOException- If anything goes wrong connecting
-
abort
Description copied from interface:AbortableAbort the server or client. -
isAborted
Description copied from interface:AbortableCheck if the server or client was aborted. -
fetchSlavesAddresses
protected static List<ServerName> fetchSlavesAddresses(ZKWatcher zkw) throws org.apache.zookeeper.KeeperException Get the list of all the region servers from the specified peer- Parameters:
zkw- zk connection to use- Returns:
- list of region server addresses or an empty list if the slave is unavailable
- Throws:
org.apache.zookeeper.KeeperException
-
getRegionServers
Get a list of all the addresses of all the available region servers for this peer cluster, or an empty list if no region servers available at peer cluster.- Returns:
- list of addresses
-
setRegionServers
Set the list of region servers for that peer- Parameters:
regionServers- list of addresses for the region servers
-
getLastRegionServerUpdate
Get the timestamp at which the last change occurred to the list of region servers to replicate to.- Returns:
- The last time the list of peer region servers changed.
-