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/22 02:57:17 UTC

[iotdb] branch xingtanzjr/fix_coordinator_cleanup created (now 6db6e96413)

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

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


      at 6db6e96413 Fix the issue that EndTime in FragmentInstanceContext is not set

This branch includes the following new commits:

     new 6db6e96413 Fix the issue that EndTime in FragmentInstanceContext is not set

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 the issue that EndTime in FragmentInstanceContext is not set

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6db6e964133edacd34d30ff666b88d4302666da5
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Fri Apr 22 10:57:05 2022 +0800

    Fix the issue that EndTime in FragmentInstanceContext is not set
---
 .../src/main/java/org/apache/iotdb/db/mpp/execution/Coordinator.java | 5 +----
 .../org/apache/iotdb/db/mpp/execution/FragmentInstanceContext.java   | 3 ++-
 .../apache/iotdb/db/service/thrift/impl/DataNodeTSIServiceImpl.java  | 5 ++++-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/Coordinator.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/Coordinator.java
index ce589f8575..ad3e26c6c3 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/Coordinator.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/Coordinator.java
@@ -31,7 +31,6 @@ import org.apache.iotdb.db.mpp.sql.analyze.QueryType;
 import org.apache.iotdb.db.mpp.sql.statement.ConfigStatement;
 import org.apache.iotdb.db.mpp.sql.statement.Statement;
 
-import org.apache.commons.lang3.Validate;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -104,9 +103,7 @@ public class Coordinator {
   }
 
   public IQueryExecution getQueryExecution(QueryId queryId) {
-    IQueryExecution execution = queryExecutionMap.get(queryId);
-    Validate.notNull(execution, "invalid queryId %s", queryId.getId());
-    return execution;
+    return queryExecutionMap.get(queryId);
   }
 
   // TODO: (xingtanzjr) need to redo once we have a concrete policy for the threadPool management
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/FragmentInstanceContext.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/FragmentInstanceContext.java
index c5a3232c18..c21c1fb5b1 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/FragmentInstanceContext.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/FragmentInstanceContext.java
@@ -36,7 +36,7 @@ import static com.google.common.base.Preconditions.checkArgument;
 public class FragmentInstanceContext extends QueryContext {
 
   private static final Logger LOGGER = LoggerFactory.getLogger(FragmentInstanceContext.class);
-
+  private static final long END_TIME_INITIAL_VALUE = -1L;
   private final FragmentInstanceId id;
 
   // TODO if we split one fragment instance into multiple pipelines to run, we need to replace it
@@ -75,6 +75,7 @@ public class FragmentInstanceContext extends QueryContext {
       FragmentInstanceId id, FragmentInstanceStateMachine stateMachine) {
     this.id = id;
     this.stateMachine = stateMachine;
+    this.executionEndTime.set(END_TIME_INITIAL_VALUE);
   }
 
   public void start() {
diff --git a/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/DataNodeTSIServiceImpl.java b/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/DataNodeTSIServiceImpl.java
index 4c3c9dd62a..d54841ab0b 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/DataNodeTSIServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/thrift/impl/DataNodeTSIServiceImpl.java
@@ -800,7 +800,10 @@ public class DataNodeTSIServiceImpl implements TSIEventHandler {
   }
 
   private void cleanupQueryExecution(Long queryId) {
-    COORDINATOR.getQueryExecution(genQueryId(queryId)).stopAndCleanup();
+    IQueryExecution queryExecution = COORDINATOR.getQueryExecution(genQueryId(queryId));
+    if (queryExecution != null) {
+      queryExecution.stopAndCleanup();
+    }
   }
 
   private QueryId genQueryId(long id) {