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

ddanielr 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 10a960c184 fixes InstanceOperationsIT (#5150)
10a960c184 is described below

commit 10a960c18432d32a5c74494ef558d345342d72d0
Author: Keith Turner <ktur...@apache.org>
AuthorDate: Mon Dec 9 07:38:01 2024 -0500

    fixes InstanceOperationsIT (#5150)
    
    The test was failing because of a change in exceptions thrown.  Made the
    impl code throw the expected exception and made it fail faster.
---
 .../core/clientImpl/InstanceOperationsImpl.java    | 26 ++++++++++++++--------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git 
a/core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java
 
b/core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java
index e17ca1f0a4..9b260d2ba0 100644
--- 
a/core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java
+++ 
b/core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java
@@ -278,18 +278,23 @@ public class InstanceOperationsImpl implements 
InstanceOperations {
   @Override
   public List<ActiveScan> getActiveScans(Collection<ServerId> servers)
       throws AccumuloException, AccumuloSecurityException {
+    servers.forEach(InstanceOperationsImpl::checkActiveScanServer);
     return queryServers(servers, this::getActiveScans, 
INSTANCE_OPS_SCANS_FINDER_POOL);
   }
 
-  private List<ActiveScan> getActiveScans(ServerId server)
-      throws AccumuloException, AccumuloSecurityException {
-
+  private static void checkActiveScanServer(ServerId server) {
     Objects.requireNonNull(server);
     Preconditions.checkArgument(
         server.getType() == ServerId.Type.SCAN_SERVER
             || server.getType() == ServerId.Type.TABLET_SERVER,
         "Server type %s is not %s or %s.", server.getType(), 
ServerId.Type.SCAN_SERVER,
         ServerId.Type.TABLET_SERVER);
+  }
+
+  private List<ActiveScan> getActiveScans(ServerId server)
+      throws AccumuloException, AccumuloSecurityException {
+
+    checkActiveScanServer(server);
 
     final var parsedTserver = HostAndPort.fromParts(server.getHost(), 
server.getPort());
     TabletScanClientService.Client rpcClient = null;
@@ -335,12 +340,7 @@ public class InstanceOperationsImpl implements 
InstanceOperations {
   private List<ActiveCompaction> getActiveCompactions(ServerId server)
       throws AccumuloException, AccumuloSecurityException {
 
-    Objects.requireNonNull(server);
-    Preconditions.checkArgument(
-        server.getType() == ServerId.Type.COMPACTOR
-            || server.getType() == ServerId.Type.TABLET_SERVER,
-        "Server type %s is not %s or %s.", server.getType(), 
ServerId.Type.COMPACTOR,
-        ServerId.Type.TABLET_SERVER);
+    checkActiveCompactionServer(server);
 
     final HostAndPort serverHostAndPort = 
HostAndPort.fromParts(server.getHost(), server.getPort());
     final List<ActiveCompaction> as = new ArrayList<>();
@@ -371,6 +371,13 @@ public class InstanceOperationsImpl implements 
InstanceOperations {
     }
   }
 
+  private static void checkActiveCompactionServer(ServerId server) {
+    Objects.requireNonNull(server);
+    Preconditions.checkArgument(
+        server.getType() == Type.COMPACTOR || server.getType() == 
Type.TABLET_SERVER,
+        "Server type %s is not %s or %s.", server.getType(), Type.COMPACTOR, 
Type.TABLET_SERVER);
+  }
+
   @Override
   @Deprecated
   public List<ActiveCompaction> getActiveCompactions()
@@ -386,6 +393,7 @@ public class InstanceOperationsImpl implements 
InstanceOperations {
   @Override
   public List<ActiveCompaction> getActiveCompactions(Collection<ServerId> 
compactionServers)
       throws AccumuloException, AccumuloSecurityException {
+    
compactionServers.forEach(InstanceOperationsImpl::checkActiveCompactionServer);
     return queryServers(compactionServers, this::getActiveCompactions,
         INSTANCE_OPS_COMPACTIONS_FINDER_POOL);
   }

Reply via email to