From 3ca81843456029a5ea224ae5758a85ec9a30b60c Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Fri, 12 Sep 2014 17:21:51 -0700 Subject: [PATCH] HBASE-11963 Synchronize peer cluster replication connection attempts (Maddineni Sukumar) --- .../replication/HBaseReplicationEndpoint.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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); }