keith-turner commented on code in PR #4845:
URL: https://github.com/apache/accumulo/pull/4845#discussion_r1734944057
##########
core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java:
##########
@@ -273,24 +283,35 @@ public boolean testClassLoad(final String className,
final String asTypeName)
@Override
public List<ActiveCompaction> getActiveCompactions(String tserver)
throws AccumuloException, AccumuloSecurityException {
- final var parsedTserver = HostAndPort.fromString(tserver);
- Client client = null;
- try {
- client = getClient(ThriftClientTypes.TABLET_SERVER, parsedTserver,
context);
+ final var serverHostAndPort = HostAndPort.fromString(tserver);
- List<ActiveCompaction> as = new ArrayList<>();
- for (var tac : client.getActiveCompactions(TraceUtil.traceInfo(),
context.rpcCreds())) {
- as.add(new ActiveCompactionImpl(context, tac, parsedTserver,
CompactionHost.Type.TSERVER));
+ final List<ActiveCompaction> as = new ArrayList<>();
+ try {
+ if (getTabletServers().contains(tserver)) {
Review Comment:
For code like the following with a large number of compactors and a large
number of tservers the call `getTabletServers().contains(tserver)` could get
really expensive because the getTabletSevers call returns a List. If it
returned a set it would be slightly better, but still expensive to recreate the
set per compactor.
```java
AccumuloClient client = ...;
for(var compactor : client.instanceOperations().getCompactors()) {
for(var compaction :
client.instanceOperations().getActiveCompactions(compactor){
System.out.println(compaction);
}
}
```
--
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]