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

This commit is contained in:
Andrew Purtell 2014-09-12 17:21:51 -07:00
parent 2be3f90fa6
commit 98be489070
1 changed files with 11 additions and 3 deletions

View File

@ -93,7 +93,11 @@ public abstract class HBaseReplicationEndpoint extends BaseReplicationEndpoint
} }
@Override @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; UUID peerUUID = null;
try { try {
peerUUID = ZKClusterId.getUUIDForCluster(zkw); peerUUID = ZKClusterId.getUUIDForCluster(zkw);
@ -158,12 +162,16 @@ public abstract class HBaseReplicationEndpoint extends BaseReplicationEndpoint
* @return list of addresses * @return list of addresses
* @throws KeeperException * @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 { try {
setRegionServers(fetchSlavesAddresses(this.getZkw())); setRegionServers(fetchSlavesAddresses(this.getZkw()));
} catch (KeeperException ke) { } catch (KeeperException ke) {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Fetch salves addresses failed.", ke); LOG.debug("Fetch slaves addresses failed", ke);
} }
reconnect(ke); reconnect(ke);
} }