You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2023/04/11 09:52:50 UTC
[iotdb] branch deregisterNPE created (now e4369a1454)
This is an automated email from the ASF dual-hosted git repository.
xiangweiwei pushed a change to branch deregisterNPE
in repository https://gitbox.apache.org/repos/asf/iotdb.git
at e4369a1454 fix npe when deregister fragmentInstance
This branch includes the following new commits:
new e4369a1454 fix npe when deregister fragmentInstance
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[iotdb] 01/01: fix npe when deregister fragmentInstance
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiangweiwei pushed a commit to branch deregisterNPE
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit e4369a1454d3e7e0ccd9bef3306e6f123cee8182
Author: Alima777 <wx...@gmail.com>
AuthorDate: Tue Apr 11 17:52:35 2023 +0800
fix npe when deregister fragmentInstance
---
.../iotdb/db/mpp/execution/memory/MemoryPool.java | 28 +++++++++++-----------
1 file changed, 14 insertions(+), 14 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 f72d935514..fc92b2f725 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
@@ -26,12 +26,11 @@ import org.apache.iotdb.tsfile.utils.Pair;
import com.google.common.util.concurrent.AbstractFuture;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
+import javax.annotation.Nullable;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.annotation.Nullable;
-
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -172,19 +171,20 @@ public class MemoryPool {
*/
public void deRegisterFragmentInstanceToQueryMemoryMap(
String queryId, String fragmentInstanceId) {
- Map<String, Long> planNodeRelatedMemory =
- queryMemoryReservations.get(queryId).get(fragmentInstanceId);
- for (Long memoryReserved : planNodeRelatedMemory.values()) {
- if (memoryReserved != 0) {
- throw new MemoryLeakException(
- "PlanNode related memory is not zero when deregister fragment instance from query memory pool.");
+ Map<String, Map<String, Long>> queryRelatedMemory = queryMemoryReservations.get(queryId);
+ if (queryRelatedMemory != null) {
+ Map<String, Long> fragmentRelatedMemory = queryRelatedMemory.get(fragmentInstanceId);
+ for (Long memoryReserved : fragmentRelatedMemory.values()) {
+ if (memoryReserved != 0) {
+ throw new MemoryLeakException(
+ "PlanNode related memory is not zero when deregister fragment instance from query memory pool.");
+ }
}
- }
- synchronized (queryMemoryReservations) {
- Map<String, Map<String, Long>> queryRelatedMemory = queryMemoryReservations.get(queryId);
- queryRelatedMemory.remove(fragmentInstanceId);
- if (queryRelatedMemory.isEmpty()) {
- queryMemoryReservations.remove(queryId);
+ synchronized (queryMemoryReservations) {
+ queryRelatedMemory.remove(fragmentInstanceId);
+ if (queryRelatedMemory.isEmpty()) {
+ queryMemoryReservations.remove(queryId);
+ }
}
}
}