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

  • Constructor Details

  • Method Details

    • disconnect

      protected void disconnect()
    • reconnect

      protected void reconnect(org.apache.zookeeper.KeeperException ke)
      A private method used to re-establish a zookeeper session with a peer cluster.
    • 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.
    • getZkw

      protected ZKWatcher 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

      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
    • 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

      public void setRegionServers(List<ServerName> regionServers)
      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.