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
Modifier and TypeClassDescriptionstatic class
Tracks 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.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 long
private static final org.slf4j.Logger
private List<ServerName>
private ZKWatcher
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
protected void
doStart()
protected void
doStop()
protected static List<ServerName>
Get the list of all the region servers from the specified peerlong
Get 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 ZKWatcher
getZkw()
Get the ZK connection to this peerboolean
Check if the server or client was aborted.protected void
reconnect
(org.apache.zookeeper.KeeperException ke) A private method used to re-establish a zookeeper session with a peer cluster.(package private) void
Closes the current ZKW (if not null) and creates a new onevoid
setRegionServers
(List<ServerName> regionServers) Set the list of region servers for that peervoid
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, init, 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
-
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: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.
-
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:Abortable
Abort the server or client. -
isAborted
Description copied from interface:Abortable
Check 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.
-