You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2018/07/26 16:59:01 UTC

hbase git commit: HBASE-20927 RSGroupAdminEndpoint doesn't handle clearing dead servers if they are not processed yet.

Repository: hbase
Updated Branches:
  refs/heads/master 8b8de1f8a -> 973b4ddcf


HBASE-20927 RSGroupAdminEndpoint doesn't handle clearing dead servers if they are not processed yet.

Signed-off-by: tedyu <yu...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/973b4ddc
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/973b4ddc
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/973b4ddc

Branch: refs/heads/master
Commit: 973b4ddcfa174f06470ebfe02977f41fb8a02a6e
Parents: 8b8de1f
Author: Sergey Soldatov <ss...@apache.org>
Authored: Wed Jul 25 23:32:36 2018 -0700
Committer: tedyu <yu...@gmail.com>
Committed: Thu Jul 26 09:58:49 2018 -0700

----------------------------------------------------------------------
 .../hbase/rsgroup/RSGroupAdminEndpoint.java     |  4 ++-
 .../hadoop/hbase/rsgroup/TestRSGroupsBase.java  | 28 ++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/973b4ddc/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java
----------------------------------------------------------------------
diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java
index b67e335..3d1f780 100644
--- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java
+++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java
@@ -539,7 +539,9 @@ public class RSGroupAdminEndpoint implements MasterCoprocessor, MasterObserver {
         filter(server -> !notClearedServers.contains(server)).
         map(ServerName::getAddress).
         collect(Collectors.toSet());
-    groupAdminServer.removeServers(clearedServer);
+    if(!clearedServer.isEmpty()) {
+      groupAdminServer.removeServers(clearedServer);
+    }
   }
 
   public void checkPermission(String request) throws IOException {

http://git-wip-us.apache.org/repos/asf/hbase/blob/973b4ddc/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBase.java
----------------------------------------------------------------------
diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBase.java b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBase.java
index 199dd98..43099db 100644
--- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBase.java
+++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBase.java
@@ -1121,4 +1121,32 @@ public abstract class TestRSGroupsBase {
       }
     });
   }
+  @Test
+  public void testClearNotProcessedDeadServer() throws Exception {
+    LOG.info("testClearNotProcessedDeadServer");
+    NUM_DEAD_SERVERS = cluster.getClusterMetrics().getDeadServerNames().size();
+    RSGroupInfo appInfo = addGroup("deadServerGroup", 1);
+    ServerName targetServer =
+        ServerName.parseServerName(appInfo.getServers().iterator().next().toString());
+    AdminProtos.AdminService.BlockingInterface targetRS =
+        ((ClusterConnection) admin.getConnection()).getAdmin(targetServer);
+    try {
+      targetServer = ProtobufUtil.toServerName(targetRS.getServerInfo(null,
+          AdminProtos.GetServerInfoRequest.newBuilder().build()).getServerInfo().getServerName());
+      //stopping may cause an exception
+      //due to the connection loss
+      targetRS.stopServer(null,
+          AdminProtos.StopServerRequest.newBuilder().setReason("Die").build());
+      NUM_DEAD_SERVERS ++;
+    } catch(Exception e) {
+    }
+    TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
+      @Override
+      public boolean evaluate() throws Exception {
+        return cluster.getClusterMetrics().getDeadServerNames().size() == NUM_DEAD_SERVERS;
+      }
+    });
+    List<ServerName> notClearedServers = admin.clearDeadServers(Lists.newArrayList(targetServer));
+    assertEquals(1, notClearedServers.size());
+  }
 }