You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "ctubbsii (via GitHub)" <gi...@apache.org> on 2023/06/26 21:43:31 UTC

[GitHub] [accumulo] ctubbsii commented on a diff in pull request #3543: avoids indirection for normally empty scans in GC ref stream

ctubbsii commented on code in PR #3543:
URL: https://github.com/apache/accumulo/pull/3543#discussion_r1242816940


##########
server/gc/src/main/java/org/apache/accumulo/gc/GCRun.java:
##########
@@ -160,7 +161,12 @@ public Stream<Reference> getReferences() {
     // there is a lot going on in this "one line" so see below for more info
     var tabletReferences = tabletStream.flatMap(tm -> {
       // combine all the entries read from file and scan columns in the metadata table
-      var fileStream = Stream.concat(tm.getFiles().stream(), tm.getScans().stream());
+      Stream<StoredTabletFile> fileStream = tm.getFiles().stream();
+      if (!tm.getScans().isEmpty()) {
+        // scans are normally empty so only introduce a layer of indirection when it actually
+        // exists.
+        fileStream = Stream.concat(fileStream, tm.getScans().stream());
+      }

Review Comment:
   Not sure if `tm.getScans()` can change while in here, but using a variable instead of calling that twice looks a little cleaner. Also moved the comment, so it doesn't wrap
   
   ```suggestion
         // scans are normally empty, so only introduce a layer of indirection when it actually exists
         final var tmScans = tm.getScans();
         if (!tmScans.isEmpty()) {
           fileStream = Stream.concat(fileStream, tmScans.stream());
         }
   ```



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