infraio commented on a change in pull request #2071:
URL: https://github.com/apache/hbase/pull/2071#discussion_r455463816



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/replication/ReplicationPeerManager.java
##########
@@ -501,6 +511,32 @@ private void checkClusterKey(String clusterKey) throws 
DoNotRetryIOException {
     }
   }
 
+  private void checkClusterId(String clusterKey) throws DoNotRetryIOException {
+    String peerClusterId = "";
+    try {
+      // Create the peer cluster config for get peer cluster id
+      Configuration peerConf = HBaseConfiguration.createClusterConf(conf, 
clusterKey);
+      ZKWatcher zkWatcher =
+        new ZKWatcher(peerConf, this + "check-peer-cluster-key", new 
Abortable() {
+          @Override public void abort(String why, Throwable e) {
+          }
+
+          @Override public boolean isAborted() {
+            return false;
+          }
+        });
+      peerClusterId = ZKClusterId.readClusterIdZNode(zkWatcher);
+    } catch (IOException | KeeperException e) {
+      throw new DoNotRetryIOException("Can't get peerClusterId for 
clusterKey=" + clusterKey, e);
+    }
+    // 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)) {

Review comment:
       The peerClusterId was not initialized in the constructor method of 
ReplicationEndpoint. So ReplicationEndpoint#getPeerUUID() will get null here.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to