Interface ReplicationEndpoint
- All Superinterfaces:
ReplicationPeerConfigListener
- All Known Implementing Classes:
BaseReplicationEndpoint
,HBaseInterClusterReplicationEndpoint
,HBaseReplicationEndpoint
,RegionReplicaReplicationEndpoint
,VerifyWALEntriesReplicationEndpoint
,VisibilityReplicationEndpoint
@LimitedPrivate("Replication")
public interface ReplicationEndpoint
extends ReplicationPeerConfigListener
ReplicationEndpoint is a plugin which implements replication to other HBase clusters, or other
systems. ReplicationEndpoint implementation can be specified at the peer creation time by
specifying it in the
ReplicationPeerConfig
. A ReplicationEndpoint is run in a thread in
each region server in the same process.
ReplicationEndpoint is closely tied to ReplicationSource in a producer-consumer relation. ReplicationSource is an HBase-private class which tails the logs and manages the queue of logs plus management and persistence of all the state for replication. ReplicationEndpoint on the other hand is responsible for doing the actual shipping and persisting of the WAL entries in the other cluster.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
static class
A context forreplicate(ReplicateContext)
method. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Waits for theReplicationEndpoint
to be up and running.void
awaitRunning
(long timeout, TimeUnit unit) Waits for theReplicationEndpoint
to to be up and running for no more than the given time.void
Waits for theReplicationEndpoint
to reach the terminated (internal) state.void
awaitTerminated
(long timeout, TimeUnit unit) Waits for theReplicationEndpoint
to reach a terminal state for no more than the given time.boolean
Whether or not, the replication endpoint can replicate to it's source cluster with the same UUIDReturns theThrowable
that caused this service to fail.Returns a UUID of the provided peer id.Returns a WALEntryFilter to use for filtering out WALEntries from the log.void
init
(ReplicationEndpoint.Context context) Initialize the replication endpoint with the given context.boolean
Returnstrue
if this service is RUNNING.boolean
Returns Returntrue
is this service is STARTING (but not yet RUNNING).boolean
replicate
(ReplicationEndpoint.ReplicateContext replicateContext) Replicate the given set of entries (in the context) to the other cluster.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 interface org.apache.hadoop.hbase.replication.ReplicationPeerConfigListener
peerConfigUpdated
-
Method Details
-
init
Initialize the replication endpoint with the given context.- Parameters:
context
- replication context- Throws:
IOException
- error occur when initialize the endpoint.
-
canReplicateToSameCluster
boolean canReplicateToSameCluster()Whether or not, the replication endpoint can replicate to it's source cluster with the same UUID -
getPeerUUID
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.- Returns:
- a UUID or null if the peer cluster does not exist or is not connected.
-
getWALEntryfilter
Returns a WALEntryFilter to use for filtering out WALEntries from the log. Replication infrastructure will call this filter before sending the edits to shipEdits().- Returns:
- a
WALEntryFilter
or null.
-
replicate
Replicate the given set of entries (in the context) to the other cluster. Can block until all the given entries are replicated. Upon this method is returned, all entries that were passed in the context are assumed to be persisted in the target cluster.- Parameters:
replicateContext
- a context where WAL entries and other parameters can be obtained.
-
isRunning
boolean isRunning()Returnstrue
if this service is RUNNING. -
isStarting
boolean isStarting()Returns Returntrue
is this service is STARTING (but not yet RUNNING). -
start
void start()Initiates service startup and returns immediately. A stopped service may not be restarted. Equivalent of startAsync call in Guava Service.- Throws:
IllegalStateException
- if the service is not new, if it has been run already.
-
awaitRunning
void awaitRunning()Waits for theReplicationEndpoint
to be up and running.- Throws:
IllegalStateException
- if the service reaches a state from which it is not possible to enter the (internal) running state. e.g. if the state is terminated when this method is called then this will throw an IllegalStateException.
-
awaitRunning
Waits for theReplicationEndpoint
to to be up and running for no more than the given time.- Parameters:
timeout
- the maximum time to waitunit
- the time unit of the timeout argument- Throws:
TimeoutException
- if the service has not reached the given state within the deadlineIllegalStateException
- if the service reaches a state from which it is not possible to enter the (internal) running state. e.g. if the state is terminated when this method is called then this will throw an IllegalStateException.
-
stop
void stop()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. -
awaitTerminated
void awaitTerminated()Waits for theReplicationEndpoint
to reach the terminated (internal) state.- Throws:
IllegalStateException
- if the service FAILED.
-
awaitTerminated
Waits for theReplicationEndpoint
to reach a terminal state for no more than the given time.- Parameters:
timeout
- the maximum time to waitunit
- the time unit of the timeout argument- Throws:
TimeoutException
- if the service has not reached the given state within the deadlineIllegalStateException
- if the service FAILED.
-
failureCause
Returns theThrowable
that caused this service to fail.- Throws:
IllegalStateException
- if this service's state isn't FAILED.
-