You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by dl...@apache.org on 2022/06/13 14:20:11 UTC

[accumulo] branch main updated: Protect against error in Manager shutdownTabletServer when tserver not found (#2766)

This is an automated email from the ASF dual-hosted git repository.

dlmarion pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new b77287acf3 Protect against error in Manager shutdownTabletServer when tserver not found (#2766)
b77287acf3 is described below

commit b77287acf33f2cce28e6639c014f0e677ea29e5f
Author: Dave Marion <dl...@apache.org>
AuthorDate: Mon Jun 13 10:20:04 2022 -0400

    Protect against error in Manager shutdownTabletServer when tserver not found (#2766)
    
    Closes #2747
---
 .../accumulo/manager/ManagerClientServiceHandler.java      |  6 +++++-
 .../org/apache/accumulo/test/functional/ManagerApiIT.java  | 14 ++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/ManagerClientServiceHandler.java b/server/manager/src/main/java/org/apache/accumulo/manager/ManagerClientServiceHandler.java
index 020b7bc6e7..7b1aae4c2e 100644
--- a/server/manager/src/main/java/org/apache/accumulo/manager/ManagerClientServiceHandler.java
+++ b/server/manager/src/main/java/org/apache/accumulo/manager/ManagerClientServiceHandler.java
@@ -261,10 +261,14 @@ public class ManagerClientServiceHandler implements ManagerClientService.Iface {
       throw new ThriftSecurityException(c.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
 
     final TServerInstance doomed = manager.tserverSet.find(tabletServer);
+    if (doomed == null) {
+      Manager.log.warn("No server found for name {}, unable to shut it down", tabletServer);
+      return;
+    }
     if (!force) {
       final TServerConnection server = manager.tserverSet.getConnection(doomed);
       if (server == null) {
-        Manager.log.warn("No server found for name {}", tabletServer);
+        Manager.log.warn("No server found for name {}, unable to shut it down", tabletServer);
         return;
       }
     }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ManagerApiIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ManagerApiIT.java
index cec9657605..402d36b4d9 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ManagerApiIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ManagerApiIT.java
@@ -313,6 +313,20 @@ public class ManagerApiIT extends SharedMiniClusterBase {
     expectPermissionSuccess(op, privilegedUser);
   }
 
+  @Test
+  public void shutdownTabletServer() throws Exception {
+    op = client -> {
+      client.shutdownTabletServer(TraceUtil.traceInfo(), rootUser.toThrift(instanceId),
+          "fakeTabletServer:9997", true);
+      return null;
+    };
+    try (AccumuloClient client = Accumulo.newClient().from(getClientProps())
+        .as(rootUser.getPrincipal(), rootUser.getToken()).build()) {
+      ClientContext context = (ClientContext) client;
+      ThriftClientTypes.MANAGER.execute(context, op);
+    }
+  }
+
   // this test should go last, because it shuts things down;
   // see the junit annotation to control test ordering at the top of this class
   @Test