Interface ReplicationEndpoint

All Superinterfaces:
ReplicationPeerConfigListener
All Known Implementing Classes:
BaseReplicationEndpoint, HBaseInterClusterReplicationEndpoint, HBaseReplicationEndpoint, 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.

  • Method Details

    • init

      Initialize the replication endpoint with the given context.
      Parameters:
      context - replication context
      Throws:
      IOException - error occur when initialize the endpoint.
    • 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()
      Returns true if this service is RUNNING.
    • isStarting

      boolean isStarting()
      Returns Return true 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 the ReplicationEndpoint 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

      void awaitRunning(long timeout, TimeUnit unit) throws TimeoutException
      Waits for the ReplicationEndpoint to to be up and running for no more than the given time.
      Parameters:
      timeout - the maximum time to wait
      unit - the time unit of the timeout argument
      Throws:
      TimeoutException - if the service has not reached the given state within the deadline
      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.
    • 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

      Waits for the ReplicationEndpoint to reach the terminated (internal) state.
      Throws:
      IllegalStateException - if the service FAILED.
    • awaitTerminated

      void awaitTerminated(long timeout, TimeUnit unit) throws TimeoutException
      Waits for the ReplicationEndpoint to reach a terminal state for no more than the given time.
      Parameters:
      timeout - the maximum time to wait
      unit - the time unit of the timeout argument
      Throws:
      TimeoutException - if the service has not reached the given state within the deadline
      IllegalStateException - if the service FAILED.
    • failureCause

      Returns the Throwable that caused this service to fail.
      Throws:
      IllegalStateException - if this service's state isn't FAILED.