hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject git commit: HBASE-11963 Synchronize peer cluster replication connection attempts. (Sukumar Maddineni)
Date Sat, 13 Sep 2014 06:51:46 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.94 045f41888 -> b69f83995


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


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

Branch: refs/heads/0.94
Commit: b69f83995dc2d62b2395402bf373a4b5f1ddb501
Parents: 045f418
Author: Lars Hofhansl <larsh@apache.org>
Authored: Fri Sep 12 23:50:59 2014 -0700
Committer: Lars Hofhansl <larsh@apache.org>
Committed: Fri Sep 12 23:50:59 2014 -0700

----------------------------------------------------------------------
 .../hbase/replication/ReplicationZookeeper.java | 39 +++++++++++++-------
 1 file changed, 25 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/b69f8399/src/main/java/org/apache/hadoop/hbase/replication/ReplicationZookeeper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/hbase/replication/ReplicationZookeeper.java b/src/main/java/org/apache/hadoop/hbase/replication/ReplicationZookeeper.java
index 6436f0b..c1c2b58 100644
--- a/src/main/java/org/apache/hadoop/hbase/replication/ReplicationZookeeper.java
+++ b/src/main/java/org/apache/hadoop/hbase/replication/ReplicationZookeeper.java
@@ -238,18 +238,23 @@ public class ReplicationZookeeper {
     if (peer == null) {
       return Collections.emptyList();
     }
-    
-    List<ServerName> addresses;
-    try {
-      addresses = fetchSlavesAddresses(peer.getZkw());
-    } catch (KeeperException ke) {
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Fetch salves addresses failed.", ke);
+    // 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.
+    synchronized (peer) {
+      List<ServerName> addresses;
+      try {
+        addresses = fetchSlavesAddresses(peer.getZkw());
+      } catch (KeeperException ke) {
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("Fetch salves addresses failed.", ke);
+        }
+        reconnectPeer(ke, peer);
+        addresses = Collections.emptyList();
       }
-      reconnectPeer(ke, peer);
-      addresses = Collections.emptyList();
+      peer.setRegionServers(addresses);
     }
-    peer.setRegionServers(addresses);
     return peer.getRegionServers();
   }
 
@@ -869,10 +874,16 @@ public class ReplicationZookeeper {
   public UUID getPeerUUID(String peerId) {
     ReplicationPeer peer = getPeerClusters().get(peerId);
     UUID peerUUID = null;
-    try {
-      peerUUID = getUUIDForCluster(peer.getZkw());
-    } catch (KeeperException ke) {
-      reconnectPeer(ke, peer);
+    // 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.
+    synchronized (peer) {
+      try {
+        peerUUID = getUUIDForCluster(peer.getZkw());
+      } catch (KeeperException ke) {
+        reconnectPeer(ke, peer);
+      }
     }
     return peerUUID;
   }


Mime
View raw message