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 a7aa59e..8a5de7a 100644 --- a/src/main/java/org/apache/hadoop/hbase/replication/ReplicationZookeeper.java +++ b/src/main/java/org/apache/hadoop/hbase/replication/ReplicationZookeeper.java @@ -628,6 +628,17 @@ public class ReplicationZookeeper { } /** + * Checks if the provided znode's parent is the same as this region server's + * path + * @param znode path's to check + * @return if this is this rs's znode + */ + public boolean isThisOurZnode(String znode) { + String otherRs = ZKUtil.joinZNode(this.rsZNode, znode); + return otherRs.equals(rsServerNameZnode); + } + + /** * Try to set a lock in another server's znode. * @param znode the server names of the other server * @return true if the lock was acquired, false in every other cases @@ -635,10 +646,6 @@ public class ReplicationZookeeper { public boolean lockOtherRS(String znode) { try { String parent = ZKUtil.joinZNode(this.rsZNode, znode); - if (parent.equals(rsServerNameZnode)) { - LOG.warn("Won't lock because this is us, we're dead!"); - return false; - } String p = ZKUtil.joinZNode(parent, RS_LOCK_ZNODE); ZKUtil.createAndWatch(this.zookeeper, p, Bytes.toBytes(rsServerNameZnode)); } catch (KeeperException e) { diff --git a/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java b/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java index 428592a..c9ffa62 100644 --- a/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java +++ b/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java @@ -593,6 +593,10 @@ public class ReplicationSourceManager { @Override public void run() { + // We could end up checking if this is us + if (zkHelper.isThisOurZnode(this.rsZnode)) { + return; + } // Wait a bit before transferring the queues, we may be shutting down. // This sleep may not be enough in some cases. try {