This is an automated email from the ASF dual-hosted git repository.
ericpai 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 b239efe75d [IOTDB-5514] Fix race condition in MemoryPool without
synchronized block (#9041)
b239efe75d is described below
commit b239efe75d4897f8b8af630cb84dce4964864306
Author: BaiJian <[email protected]>
AuthorDate: Fri Feb 10 17:23:18 2023 +0800
[IOTDB-5514] Fix race condition in MemoryPool without synchronized block
(#9041)
---
.../java/org/apache/iotdb/db/mpp/execution/memory/MemoryPool.java | 8 ++++++--
1 file changed, 6 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..3c9dbb10e3 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,11 @@ public class MemoryPool {
return maxBytes;
}
- /** @return if reserve succeed, pair.right will be true, otherwise false */
+ /**
+ * Reserve memory with bytesToReserve.
+ *
+ * @return if reserve succeed, pair.right will be true, otherwise false
+ */
public Pair<ListenableFuture<Void>, Boolean> reserve(
String queryId,
String fragmentInstanceId,
@@ -367,7 +371,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) {