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 2022/04/19 09:40:49 UTC

[iotdb] branch xingtanzjr/mpp_issues updated: add queryExecution cleanup after fetching schema

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

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


The following commit(s) were added to refs/heads/xingtanzjr/mpp_issues by this push:
     new d7bfa09ebc add queryExecution cleanup after fetching schema
d7bfa09ebc is described below

commit d7bfa09ebcab9295c0192b5ae62d1ed90f1a0a79
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Tue Apr 19 17:40:38 2022 +0800

    add queryExecution cleanup after fetching schema
---
 .../src/main/java/org/apache/iotdb/db/mpp/buffer/SourceHandle.java | 7 -------
 .../org/apache/iotdb/db/mpp/sql/analyze/ClusterSchemaFetcher.java  | 4 +++-
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SourceHandle.java b/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SourceHandle.java
index 9a38876954..e33265a6a2 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SourceHandle.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SourceHandle.java
@@ -71,8 +71,6 @@ public class SourceHandle implements ISourceHandle {
   private int currSequenceId = 0;
   private int nextSequenceId = 0;
   private int lastSequenceId = Integer.MAX_VALUE;
-  private int numActiveGetDataBlocksTask = 0;
-  private boolean noMoreTsBlocks;
   private boolean closed;
   private Throwable throwable;
 
@@ -161,7 +159,6 @@ public class SourceHandle implements ISourceHandle {
     if (future.isDone()) {
       nextSequenceId = endSequenceId;
       executorService.submit(new GetDataBlocksTask(startSequenceId, endSequenceId, reservedBytes));
-      numActiveGetDataBlocksTask += 1;
     } else {
       nextSequenceId = endSequenceId + 1;
       // The future being not completed indicates,
@@ -176,7 +173,6 @@ public class SourceHandle implements ISourceHandle {
         // Memory has been reserved. Submit a GetDataBlocksTask for these blocks.
         executorService.submit(
             new GetDataBlocksTask(startSequenceId, endSequenceId, reservedBytes));
-        numActiveGetDataBlocksTask += 1;
       }
 
       // Submit a GetDataBlocksTask when memory is freed.
@@ -189,7 +185,6 @@ public class SourceHandle implements ISourceHandle {
                     sequenceIdOfUnReservedDataBlock,
                     sequenceIdOfUnReservedDataBlock + 1,
                     sizeOfUnReservedDataBlock));
-            numActiveGetDataBlocksTask += 1;
             bufferRetainedSizeInBytes += sizeOfUnReservedDataBlock;
           },
           executorService);
@@ -369,8 +364,6 @@ public class SourceHandle implements ISourceHandle {
                   .free(localFragmentInstanceId.getQueryId(), reservedBytes);
             }
           }
-        } finally {
-          numActiveGetDataBlocksTask -= 1;
         }
       }
       // TODO: try to issue another GetDataBlocksTask to make the query run faster.
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/sql/analyze/ClusterSchemaFetcher.java b/server/src/main/java/org/apache/iotdb/db/mpp/sql/analyze/ClusterSchemaFetcher.java
index 3877706717..929ca01a55 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/sql/analyze/ClusterSchemaFetcher.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/sql/analyze/ClusterSchemaFetcher.java
@@ -78,7 +78,9 @@ public class ClusterSchemaFetcher implements ISchemaFetcher {
       throw new RuntimeException("cannot fetch schema, status is: " + executionResult.status);
     }
     TsBlock tsBlock = coordinator.getQueryExecution(queryId).getBatchResult();
-    // TODO: (xingtanzjr) need to release this query's resource here
+    // TODO: (xingtanzjr) need to release this query's resource here. This is a temporary way
+    coordinator.getQueryExecution(queryId).stopAndCleanup();
+
     SchemaTree result = new SchemaTree();
     result.setStorageGroups(storageGroups);
     Binary binary;