From beca6bc19f9ae0b2a76ae46cfa632901dd076b48 Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Fri, 12 Sep 2014 10:46:55 -0700 Subject: [PATCH] HBASE-11963 Synchronize peer cluster replication connection attempts (Sukumar Maddineni) 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. --- .../hadoop/hbase/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 4b9a28f..ea8498a 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); } -- 1.8.5.2 (Apple Git-48)