keith-turner commented on a change in pull request #2096:
URL: https://github.com/apache/accumulo/pull/2096#discussion_r632109671



##########
File path: 
core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java
##########
@@ -204,6 +210,54 @@ public boolean testClassLoad(final String className, final 
String asTypeName)
     }
   }
 
+  @Override
+  public List<ActiveCompaction> getActiveCompactions()
+      throws AccumuloException, AccumuloSecurityException {
+
+    List<HostAndPort> compactors = 
ExternalCompactionUtil.getCompactorAddrs(context);
+    List<String> tservers = getTabletServers();
+
+    int numThreads = Math.max(4, Math.min((tservers.size() + 
compactors.size()) / 10, 256));
+    var executorService =
+        ThreadPools.createFixedThreadPool(numThreads, "getactivecompactions", 
false);
+    try {
+      List<Future<List<ActiveCompaction>>> futures = new ArrayList<>();
+
+      for (String tserver : tservers) {
+        futures.add(executorService.submit(() -> 
getActiveCompactions(tserver)));
+      }
+
+      for (HostAndPort compactorAddr : compactors) {
+        futures
+            .add(
+                executorService
+                    .submit(
+                        () -> 
ExternalCompactionUtil.getActiveCompaction(compactorAddr, context)
+                            .stream().map(tac -> new 
ActiveCompactionImpl(context, tac,
+                                compactorAddr, CompactionHost.Type.COMPACTOR))
+                            .collect(Collectors.toList())));

Review comment:
       Improved this a bit in 162dd806b1754f890c4f139a3611c54024c072a2.  Tried 
to rename the var `tac` to `thriftActiveCompaction` but it caused the 
formatting of the updated code to be unsightly.




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

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


Reply via email to