HBASE-10249 TestReplicationSyncUpTool fails because failover takes too long

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1560201 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2014-01-21 21:30:49 +00:00
parent a0bb401537
commit 028a00cc31
3 changed files with 15 additions and 4 deletions

View File

@ -106,4 +106,11 @@ public interface ReplicationQueues {
* @return a list of server names
*/
List<String> getListOfReplicators();
/**
* Checks if the provided znode is the same as this region server's
* @param znode to check
* @return if this is this rs's znode
*/
boolean isThisOurZnode(String znode);
}

View File

@ -153,13 +153,14 @@ public class ReplicationQueuesZKImpl extends ReplicationStateZKBase implements R
return 0;
}
@Override
public boolean isThisOurZnode(String znode) {
return ZKUtil.joinZNode(this.queuesZNode, znode).equals(this.myQueuesZnode);
}
@Override
public SortedMap<String, SortedSet<String>> claimQueues(String regionserverZnode) {
SortedMap<String, SortedSet<String>> newQueues = new TreeMap<String, SortedSet<String>>();
if (ZKUtil.joinZNode(this.queuesZNode, regionserverZnode).equals(this.myQueuesZnode)) {
LOG.warn("An attempt was made to claim our own queues on region server " + regionserverZnode);
return newQueues;
}
// check whether there is multi support. If yes, use it.
if (conf.getBoolean(HConstants.ZOOKEEPER_USEMULTI, true)) {
LOG.info("Atomically moving " + regionserverZnode + "'s hlogs to my queue");

View File

@ -475,6 +475,9 @@ public class ReplicationSourceManager implements ReplicationListener {
@Override
public void run() {
if (this.rq.isThisOurZnode(rsZnode)) {
return;
}
// Wait a bit before transferring the queues, we may be shutting down.
// This sleep may not be enough in some cases.
try {