You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2022/04/22 06:21:03 UTC
[iotdb] branch master updated: Fix the issue that EndTime in FragmentInstanceContext is not set (#5636)
This is an automated email from the ASF dual-hosted git repository.
jackietien 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 8df96c5ce2 Fix the issue that EndTime in FragmentInstanceContext is not set (#5636)
8df96c5ce2 is described below
commit 8df96c5ce29dc73b87f4b9556d5eb5d0bba0dd58
Author: Zhang.Jinrui <xi...@gmail.com>
AuthorDate: Fri Apr 22 14:20:59 2022 +0800
Fix the issue that EndTime in FragmentInstanceContext is not set (#5636)
---
.../src/main/java/org/apache/iotdb/db/mpp/execution/Coordinator.java | 5 +----
.../org/apache/iotdb/db/mpp/execution/FragmentInstanceContext.java | 5 +++--
.../apache/iotdb/db/service/thrift/impl/DataNodeTSIServiceImpl.java | 5 ++++-
3 files changed, 8 insertions(+), 7 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..2f2892619b 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() {
@@ -106,7 +107,7 @@ public class FragmentInstanceContext extends QueryContext {
// use compare and set from initial value to avoid overwriting if there
// were a duplicate notification, which shouldn't happen
- executionEndTime.compareAndSet(null, now);
+ executionEndTime.compareAndSet(END_TIME_INITIAL_VALUE, now);
endNanos.compareAndSet(0, System.nanoTime());
}
}
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) {