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 16:53:45 UTC

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

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



##########
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:
       This changes the behavior from getting a snapshot each time the iterator is requested to only getting a snapshot once ever.  Also if the iterator over the snapshot is only created once, then once its exhausted its seem like this iterable will always return an empty iterator.  I think the previous behavior needs to be maintained and the following might do it.
   
   ```suggestion
       Iterable<Compactable> compactables = () -> transform( onlineTablets.snapshot().values().iterator(), 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