You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2023/04/28 09:25:07 UTC

[iotdb] branch master updated: [IOTDB-5832] Fix Bug: The size of readyQueue is negative incorrectly

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

jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 0a7d2b73d8b [IOTDB-5832] Fix Bug: The size of readyQueue is negative incorrectly
0a7d2b73d8b is described below

commit 0a7d2b73d8beaa2723c82b3352af666561b6c1e8
Author: Xiangwei Wei <34...@users.noreply.github.com>
AuthorDate: Fri Apr 28 17:25:00 2023 +0800

    [IOTDB-5832] Fix Bug: The size of readyQueue is negative incorrectly
---
 .../iotdb/db/mpp/execution/schedule/queue/IndexedBlockingQueue.java   | 1 +
 .../schedule/queue/multilevelqueue/MultilevelPriorityQueue.java       | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/queue/IndexedBlockingQueue.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/queue/IndexedBlockingQueue.java
index 6fdcbb03920..d219571b44c 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/queue/IndexedBlockingQueue.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/queue/IndexedBlockingQueue.java
@@ -104,6 +104,7 @@ public abstract class IndexedBlockingQueue<E extends IDIndexedAccessible> {
       return null;
     }
     size--;
+    Preconditions.checkState(size >= 0, "The size of readyQueue cannot be negative.");
     return output;
   }
 
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/queue/multilevelqueue/MultilevelPriorityQueue.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/queue/multilevelqueue/MultilevelPriorityQueue.java
index 2c5bc41fa17..529dd95cfb5 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/queue/multilevelqueue/MultilevelPriorityQueue.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/queue/multilevelqueue/MultilevelPriorityQueue.java
@@ -157,10 +157,10 @@ public class MultilevelPriorityQueue extends IndexedBlockingReserveQueue<DriverT
     checkArgument(driverTask != null, "driverTask is null");
     for (PriorityQueue<DriverTask> level : levelWaitingSplits) {
       if (level.remove(driverTask)) {
-        break;
+        return driverTask;
       }
     }
-    return driverTask;
+    return null;
   }
 
   @Override