This is an automated email from the ASF dual-hosted git repository.

ddanielr pushed a commit to branch elasticity
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/elasticity by this push:
     new 2e691d5cfa Handle exception when compaction queue is empty (#4079)
2e691d5cfa is described below

commit 2e691d5cfaaa98a4536f75d45a461db8ff24a685
Author: Daniel Roberts <ddani...@gmail.com>
AuthorDate: Fri Dec 15 10:10:43 2023 -0500

    Handle exception when compaction queue is empty (#4079)
    
    * Handle exception if compaction queue is empty
    
    Handles a NullElementException if `getLowestPriority` is called on an
    empty compaction priority queue.
    
    * Refactor getLowestPriority to avoid exception
---
 .../accumulo/manager/compaction/queue/CompactionJobPriorityQueue.java  | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/server/manager/src/main/java/org/apache/accumulo/manager/compaction/queue/CompactionJobPriorityQueue.java
 
b/server/manager/src/main/java/org/apache/accumulo/manager/compaction/queue/CompactionJobPriorityQueue.java
index ae1c278147..74f168a985 100644
--- 
a/server/manager/src/main/java/org/apache/accumulo/manager/compaction/queue/CompactionJobPriorityQueue.java
+++ 
b/server/manager/src/main/java/org/apache/accumulo/manager/compaction/queue/CompactionJobPriorityQueue.java
@@ -158,6 +158,9 @@ public class CompactionJobPriorityQueue {
   }
 
   public synchronized long getLowestPriority() {
+    if (jobQueue.isEmpty()) {
+      return 0;
+    }
     return jobQueue.lastKey().job.getPriority();
   }
 

Reply via email to