Repository: hbase
Updated Branches:
  refs/heads/0.98 9660fb0df -> 128a1cce7
  refs/heads/branch-1 949156c63 -> 3ca818434
  refs/heads/master 2be3f90fa -> 98be48907


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/98be4890
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/98be4890
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/98be4890

Branch: refs/heads/master
Commit: 98be489070622fd01183b7f129caa99d6aaaa1eb
Parents: 2be3f90
Author: Andrew Purtell <[email protected]>
Authored: Fri Sep 12 17:21:51 2014 -0700
Committer: Andrew Purtell <[email protected]>
Committed: Fri Sep 12 17:21:51 2014 -0700

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


http://git-wip-us.apache.org/repos/asf/hbase/blob/98be4890/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