Reidddddd commented on a change in pull request #3911:
URL: https://github.com/apache/hbase/pull/3911#discussion_r761614472



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java
##########
@@ -242,21 +276,150 @@ public boolean isAborted() {
     if (children == null) {
       return Collections.emptyList();
     }
+
+    Configuration conf = HBaseConfiguration.create();
+
+    /** if use other balancer, return all regionservers */
+    if (!conf.get(HConstants.HBASE_MASTER_LOADBALANCER_CLASS)
+      .equals(RSGroupBasedLoadBalancer.class.getName())
+      || hostServerName == null) {
+      if(LOG.isDebugEnabled()) {
+        LOG.debug("Use replication random choose policy...");
+      }
+      return parseServerNameFromList(children);
+    } else {
+      /** if use rsgroup balancer,
+       * just return regionservers belong to the same rsgroup or default 
rsgroup */
+      if(LOG.isDebugEnabled()) {
+        LOG.debug("Use replication rsgroup choose policy...");
+      }
+      Map<String, String> serverNameHostPortMapping = new HashMap<>();
+      for (String serverName : children) {
+        String mappingKey =
+          serverName.split(",")[0] + ServerName.SERVERNAME_SEPARATOR + 
serverName.split(",")[1];
+        serverNameHostPortMapping.put(mappingKey, serverName);
+      }
+
+      String groupName = null;
+      RSGroupInfo rsGroupInfo = null;
+      try {
+        rsGroupInfo = getRSGroupInfoOfServer(conn.toConnection(), 
hostServerName.getAddress());
+      }catch (IOException e) {
+        e.printStackTrace();
+        LOG.error("rsGroupInfo error!", e);
+      }
+      if (rsGroupInfo != null) {
+        groupName = rsGroupInfo.getName();
+      }
+      try {
+        List<ServerName> serverList =
+          getGroupServerListFromTargetZkCluster(groupName, zkw, 
serverNameHostPortMapping);
+        if (serverList.size() > 0) {
+          // if target cluster open group balancer, serverList must has 
server(s)
+          LOG.debug("group list > 0");
+          threadLocal.get().getAndSet(true);
+          return serverList;
+        }
+        else {
+          // if not, choose sinkers from all regionservers
+          LOG.debug("target group list <= 0");

Review comment:
       ditto. Please add check `LOG.isDebugEnabled() {}` and elsewhere




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to