milleruntime commented on code in PR #2767:
URL: https://github.com/apache/accumulo/pull/2767#discussion_r895748379
##########
server/gc/src/main/java/org/apache/accumulo/gc/GCRun.java:
##########
@@ -139,21 +140,29 @@ public Stream<String> getBlipPaths() throws
TableNotFoundException {
public Stream<Reference> getReferences() {
Stream<TabletMetadata> tabletStream;
+ // create a stream of metadata entries read from file, scan and tablet dir
columns
if (level == Ample.DataLevel.ROOT) {
tabletStream = Stream.of(context.getAmple().readTablet(RootTable.EXTENT,
DIR, FILES, SCANS));
} else {
- tabletStream =
TabletsMetadata.builder(context).scanTable(level.metaTable())
- .checkConsistency().fetch(DIR, FILES, SCANS).build().stream();
+ try (var tabletsMetadata =
TabletsMetadata.builder(context).scanTable(level.metaTable())
+ .checkConsistency().fetch(DIR, FILES, SCANS).build()) {
+ tabletStream = tabletsMetadata.stream();
+ }
}
+ // there is a lot going on in this "one line" so see below for more info
return tabletStream.flatMap(tm -> {
- Stream<Reference> refs = Stream.concat(tm.getFiles().stream(),
tm.getScans().stream())
- .map(f -> new Reference(tm.getTableId(), f.getMetaUpdateDelete()));
+ // combine all the entries read from file and scan columns in the
metadata table
+ var fileStream = Stream.concat(tm.getFiles().stream(),
tm.getScans().stream());
+ // map the files to Reference objects
+ var stream = fileStream.map(f -> new ReferenceFile(tm.getTableId(),
f.getMetaUpdateDelete()));
+ // if dirName is populated then we have a tablet directory aka srv:dir
if (tm.getDirName() != null) {
- refs = Stream.concat(refs,
- Stream.of(new ReferenceDirectory(tm.getTableId(),
tm.getDirName())));
+ // add the tablet directory to the stream
+ var tabletDir = new ReferenceDirectory(tm.getTableId(),
tm.getDirName());
Review Comment:
See my other comment but usually the `dirName` will be just the name of the
directory.
--
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]