HBASE-11963 Synchronize peer cluster replication connection attempts (Maddineni 
Sukumar)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/3ca81843
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/3ca81843
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/3ca81843

Branch: refs/heads/branch-1
Commit: 3ca81843456029a5ea224ae5758a85ec9a30b60c
Parents: 949156c
Author: Andrew Purtell <apurt...@apache.org>
Authored: Fri Sep 12 17:21:51 2014 -0700
Committer: Andrew Purtell <apurt...@apache.org>
Committed: Fri Sep 12 17:21:57 2014 -0700

----------------------------------------------------------------------
 .../hbase/replication/HBaseReplicationEndpoint.java   | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/3ca81843/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java
----------------------------------------------------------------------
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<ServerName> 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<ServerName> 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);
     }

Reply via email to