keith-turner commented on code in PR #3551:
URL: https://github.com/apache/accumulo/pull/3551#discussion_r1256579210
##########
server/manager/src/main/java/org/apache/accumulo/manager/compaction/queue/CompactionJobQueues.java:
##########
@@ -51,6 +52,46 @@ public void add(TabletMetadata tabletMetadata,
Collection<CompactionJob> jobs) {
}
}
+ public KeySetView<CompactionExecutorId,CompactionJobPriorityQueue>
getQueueIds() {
+ return priorityQueues.keySet();
+ }
+
+ public long getQueueMaxSize(CompactionExecutorId executorId) {
+ // Handle if the queue no longer exists.
+ if (priorityQueues.get(executorId) == null) {
+ return 0;
+ }
+ return priorityQueues.get(executorId).getMaxSize();
Review Comment:
There is a race condition calling get() twice on the map. Could do the
following to only call it once an avoid the race.
```suggestion
var prioQ = priorityQueues.get(executorId);
return prioQ == null ? 0 : prioQ.getMaxSize();
```
--
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]