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

ericpai pushed a commit to branch bugfix/iotdb-5514
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 196e489f189dc0b041410745a49d15adb3ca6d30
Author: ericpai <[email protected]>
AuthorDate: Fri Feb 10 15:07:50 2023 +0800

    [IOTDB-5514] Fix race condition in MemoryPool without synchronized block
---
 .../java/org/apache/iotdb/db/mpp/execution/memory/MemoryPool.java   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/memory/MemoryPool.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/memory/MemoryPool.java
index 6972111810..1a7db5385d 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/memory/MemoryPool.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/memory/MemoryPool.java
@@ -140,7 +140,9 @@ public class MemoryPool {
     return maxBytes;
   }
 
-  /** @return if reserve succeed, pair.right will be true, otherwise false */
+  /**
+   * @return if reserve succeed, pair.right will be true, otherwise false
+   */
   public Pair<ListenableFuture<Void>, Boolean> reserve(
       String queryId,
       String fragmentInstanceId,
@@ -367,7 +369,7 @@ public class MemoryPool {
     return reservedBytes;
   }
 
-  public void clearMemoryReservationMap(
+  public synchronized void clearMemoryReservationMap(
       String queryId, String fragmentInstanceId, String planNodeId) {
     if (queryMemoryReservations.get(queryId) == null
         || queryMemoryReservations.get(queryId).get(fragmentInstanceId) == 
null) {

Reply via email to