diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java index 4b9a28f7e8c..ea8498af9b4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java @@ -93,7 +93,11 @@ public abstract class HBaseReplicationEndpoint extends BaseReplicationEndpoint } @Override - public UUID getPeerUUID() { + // Synchronize peer cluster connection attempts to avoid races and rate + // limit connections when multiple replication sources try to connect to + // the peer cluster. If the peer cluster is down we can get out of control + // over time. + public synchronized UUID getPeerUUID() { UUID peerUUID = null; try { peerUUID = ZKClusterId.getUUIDForCluster(zkw); @@ -158,12 +162,16 @@ public abstract class HBaseReplicationEndpoint extends BaseReplicationEndpoint * @return list of addresses * @throws KeeperException */ - public List getRegionServers() { + // Synchronize peer cluster connection attempts to avoid races and rate + // limit connections when multiple replication sources try to connect to + // the peer cluster. If the peer cluster is down we can get out of control + // over time. + public synchronized List getRegionServers() { try { setRegionServers(fetchSlavesAddresses(this.getZkw())); } catch (KeeperException ke) { if (LOG.isDebugEnabled()) { - LOG.debug("Fetch salves addresses failed.", ke); + LOG.debug("Fetch slaves addresses failed", ke); } reconnect(ke); }