cshannon commented on code in PR #5102:
URL: https://github.com/apache/accumulo/pull/5102#discussion_r1869839829


##########
core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java:
##########
@@ -404,19 +386,34 @@ public List<ActiveCompaction> getActiveCompactions()
   @Override
   public List<ActiveCompaction> getActiveCompactions(Collection<ServerId> 
compactionServers)
       throws AccumuloException, AccumuloSecurityException {
+    return queryServers(compactionServers, this::getActiveCompactions,
+        INSTANCE_OPS_COMPACTIONS_FINDER_POOL);
+  }
+
+  private <T> List<T> queryServers(Collection<ServerId> servers, 
ServerQuery<List<T>> serverQuery,
+      ThreadPoolNames pool) throws AccumuloException, 
AccumuloSecurityException {
+
+    final ExecutorService executorService;
+    // If size 0 or 1 there's no need to create a thread pool
+    if (servers.isEmpty()) {
+      return List.of();
+    } else if (servers.size() == 1) {
+      executorService = MoreExecutors.newDirectExecutorService();
+    } else {
+      int numThreads = Math.max(4, Math.min((servers.size()) / 10, 256));

Review Comment:
   It could be too many but I am not sure, I refactored this code to be shared 
for getting scans and compactions. The current code in main for 
getCompactions() was already creating up to 256 threads so it came from that: 
https://github.com/apache/accumulo/blob/c6ec9697da2cfa517eb028d8937ecf10b31c9d6a/core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java#L408
   
   We could lower the number to something smaller for both.



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