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.
  • Field Details

  • Constructor Details

  • 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

      public void init(ReplicationEndpoint.Context context) throws IOException
      Description copied from interface: ReplicationEndpoint
      Initialize the replication endpoint with the given context.
      Specified by:
      init in interface ReplicationEndpoint
      Overrides:
      init in class BaseReplicationEndpoint
      Parameters:
      context - replication context
      Throws:
      IOException - error occur when initialize the endpoint.
    • disconnect

      private void disconnect()
    • start

      public void 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 interface ReplicationEndpoint
    • stop

      public void 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 interface ReplicationEndpoint
    • doStart

      protected void doStart()
      Specified by:
      doStart in class org.apache.hbase.thirdparty.com.google.common.util.concurrent.AbstractService
    • doStop

      protected void doStop()
      Specified by:
      doStop in class org.apache.hbase.thirdparty.com.google.common.util.concurrent.AbstractService
    • getPeerUUID

      public UUID 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 interface ReplicationEndpoint
      Returns:
      a UUID or null if the peer cluster does not exist or is not connected.
    • connect

      Throws:
      IOException
    • abort

      public void abort(String why, Throwable e)
      Description copied from interface: Abortable
      Abort the server or client.
      Specified by:
      abort in interface Abortable
      Parameters:
      why - Why we're aborting.
      e - Throwable that caused abort. Can be null.
    • isAborted

      public boolean isAborted()
      Description copied from interface: Abortable
      Check if the server or client was aborted.
      Specified by:
      isAborted in interface Abortable
      Returns:
      true if the server or client was aborted, false otherwise
    • 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

      protected void chooseSinks()
    • getNumSinks

      protected int getNumSinks()
    • getReplicationSink

      Get a randomly-chosen replication sink to replicate to.
      Returns:
      a replication sink to replicate to
      Throws:
      IOException
    • reportBadSink

      Report a SinkPeer as 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 a SinkPeer successfully replicated a chunk of data. The SinkPeer that had a failed replication attempt on it
    • getSinkServers