You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/03/08 20:06:17 UTC

[GitHub] [accumulo] ctubbsii commented on a change in pull request #2552: Some compaction code cleanup

ctubbsii commented on a change in pull request #2552:
URL: https://github.com/apache/accumulo/pull/2552#discussion_r822026987



##########
File path: server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
##########
@@ -754,14 +754,9 @@ public void run() {
     mincMetrics = new TabletServerMinCMetrics();
     ceMetrics = new CompactionExecutorsMetrics();
     MetricsUtil.initializeProducers(metrics, updateMetrics, scanMetrics, mincMetrics, ceMetrics);
-
-    this.compactionManager = new CompactionManager(new Iterable<Compactable>() {
-      @Override
-      public Iterator<Compactable> iterator() {
-        return Iterators.transform(onlineTablets.snapshot().values().iterator(),
-            Tablet::asCompactable);
-      }
-    }, getContext(), ceMetrics);
+    var tabletIterator = onlineTablets.snapshot().values().iterator();
+    Iterable<Compactable> compactables = () -> transform(tabletIterator, Tablet::asCompactable);

Review comment:
       Is it possible to just use a stream from `onlineTablets.snapshot().values()` instead of calling `iterator()` explicitly and using a Guava utility to transform the iterator? It seems like you could just do something like:
   
   ```java
       Stream<Compactable> compactables = onlineTablets.snapshot().values().stream().map(Tablet::asCompactable);
   ```




-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org