You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2014/09/13 08:51:46 UTC
git commit: HBASE-11963 Synchronize peer cluster replication
connection attempts. (Sukumar Maddineni)
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 <la...@apache.org>
Authored: Fri Sep 12 23:50:59 2014 -0700
Committer: Lars Hofhansl <la...@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;
}