HBASE-4654 [replication] Add a check to make sure we don't replicate to ourselves (Demai)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1541279 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2013-11-12 22:31:56 +00:00
parent 60ad668311
commit 4837c424f3
1 changed files with 7 additions and 1 deletions

View File

@ -212,6 +212,12 @@ public class ReplicationSource extends Thread
// resetting to 1 to reuse later
sleepMultiplier = 1;
// In rare case, zookeeper setting may be messed up. That leads to the incorrect
// peerClusterId value, which is the same as the source clusterId
if (clusterId.equals(peerClusterId)) {
this.terminate("ClusterId " + clusterId + " is replicating to itself: peerClusterId "
+ peerClusterId);
}
LOG.info("Replicating "+clusterId + " -> " + peerClusterId);
// If this is recovered, the queue is already full and the first log
@ -802,4 +808,4 @@ public class ReplicationSource extends Thread
", currently replicating from: " + this.currentPath +
" at position: " + position;
}
}
}