You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "keith-turner (via GitHub)" <gi...@apache.org> on 2023/07/07 22:51:17 UTC

[GitHub] [accumulo] keith-turner commented on a diff in pull request #3551: Add Metrics for CompactionJobPriority Queues

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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org