keith-turner commented on code in PR #4207:
URL: https://github.com/apache/accumulo/pull/4207#discussion_r1480051414
##########
server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectWriteAheadLogs.java:
##########
@@ -83,13 +85,17 @@ public class GarbageCollectWriteAheadLogs {
this.fs = fs;
this.liveServers = liveServers;
this.walMarker = new WalStateManager(context);
- this.store = () -> Iterators.concat(
- context.getAmple().readTablets().forLevel(DataLevel.ROOT).filter(new
HasWalsFilter())
- .fetch(LOCATION, LAST, LOGS, PREV_ROW, SUSPEND).build().iterator(),
-
context.getAmple().readTablets().forLevel(DataLevel.METADATA).filter(new
HasWalsFilter())
- .fetch(LOCATION, LAST, LOGS, PREV_ROW, SUSPEND).build().iterator(),
- context.getAmple().readTablets().forLevel(DataLevel.USER).filter(new
HasWalsFilter())
- .fetch(LOCATION, LAST, LOGS, PREV_ROW,
SUSPEND).build().iterator());
+ TabletsMetadata root =
context.getAmple().readTablets().forLevel(DataLevel.ROOT)
+ .filter(new HasWalsFilter()).fetch(LOCATION, LAST, LOGS, PREV_ROW,
SUSPEND).build();
+ TabletsMetadata metadata =
context.getAmple().readTablets().forLevel(DataLevel.METADATA)
+ .filter(new HasWalsFilter()).fetch(LOCATION, LAST, LOGS, PREV_ROW,
SUSPEND).build();
+ TabletsMetadata user =
context.getAmple().readTablets().forLevel(DataLevel.USER)
+ .filter(new HasWalsFilter()).fetch(LOCATION, LAST, LOGS, PREV_ROW,
SUSPEND).build();
+ this.store = Streams.concat(root.stream(), metadata.stream(),
user.stream()).onClose(() -> {
Review Comment:
> Another option could be to keep things the same (using the iterators as
the underlying resource for store) then make GarbageCollectWriteAheadLogs
autoclosable
Given the way its used, that seems like a nice solution.
--
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]