cshannon commented on code in PR #5102:
URL: https://github.com/apache/accumulo/pull/5102#discussion_r1855529713
##########
shell/src/main/java/org/apache/accumulo/shell/commands/ListScansCommand.java:
##########
@@ -66,11 +72,34 @@ public int execute(final String fullCommand, final
CommandLine cl, final Shell s
servers.addAll(instanceOps.getServers(ServerId.Type.TABLET_SERVER));
}
- shellState.printLines(new ActiveScanIterator(servers, instanceOps),
paginate);
+ Stream<String> activeScans = getActiveScans(instanceOps, servers);
+ activeScans = appendHeader(activeScans);
+ shellState.printLines(activeScans.iterator(), paginate);
return 0;
}
+ private Stream<String> getActiveScans(InstanceOperations instanceOps,
List<ServerId> servers) {
+ List<List<ServerId>> partServerIds = Lists.partition(servers, 100);
+ return partServerIds.stream().flatMap(ids -> {
+ try {
+ return instanceOps.getActiveScans(ids).stream().map(as -> {
+ var dur = new DurationFormat(as.getAge(), "");
+ var dur2 = new DurationFormat(as.getLastContactTime(), "");
+ var server = as.getHost();
+ return (String.format(
+ "%21s |%21s |%21s |%9s |%9s |%7s |%6s |%8s |%8s |%10s |%20s
|%10s |%20s |%10s | %s",
+ server.getResourceGroup(), server.toHostPortString(),
as.getClient(), dur, dur2,
+ as.getState(), as.getType(), as.getUser(), as.getTable(),
as.getColumns(),
+ as.getAuthorizations(), (as.getType() == ScanType.SINGLE ?
as.getTablet() : "N/A"),
+ as.getScanid(), as.getSsiList(), as.getSsio()));
+ });
+ } catch (AccumuloException | AccumuloSecurityException e) {
+ return Stream.of("ERROR " + e.getMessage());
Review Comment:
Same thing as my comment on getHost(), that's what listcompactions
[does](https://github.com/apache/accumulo/blob/5147077ff1535294f469a52732a3b0f3d985c236/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionHelper.java#L139)
and I modeled the changes here after that command.
--
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]