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 needed
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]