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/09/23 01:08:51 UTC

[iotdb] branch master updated: reset ResultHandleContext before retyr (#7405)

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 fb8400e161 reset ResultHandleContext before retyr (#7405)
fb8400e161 is described below

commit fb8400e161a33108c5af7d606f2138c9e31a2c37
Author: Zhang.Jinrui <xi...@gmail.com>
AuthorDate: Fri Sep 23 09:08:45 2022 +0800

    reset ResultHandleContext before retyr (#7405)
---
 .../java/org/apache/iotdb/db/mpp/common/MPPQueryContext.java | 12 ++++++++++--
 .../apache/iotdb/db/mpp/plan/execution/QueryExecution.java   |  2 ++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/MPPQueryContext.java b/server/src/main/java/org/apache/iotdb/db/mpp/common/MPPQueryContext.java
index 8f4e53470d..57e201ecd7 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/common/MPPQueryContext.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/MPPQueryContext.java
@@ -64,7 +64,7 @@ public class MPPQueryContext {
     this.session = session;
     this.localDataBlockEndpoint = localDataBlockEndpoint;
     this.localInternalEndpoint = localInternalEndpoint;
-    this.resultNodeContext = new ResultNodeContext(queryId);
+    this.initResultNodeContext();
   }
 
   public MPPQueryContext(
@@ -76,9 +76,17 @@ public class MPPQueryContext {
       long timeOut,
       long startTime) {
     this(sql, queryId, session, localDataBlockEndpoint, localInternalEndpoint);
-    this.resultNodeContext = new ResultNodeContext(queryId);
     this.timeOut = timeOut;
     this.startTime = startTime;
+    this.initResultNodeContext();
+  }
+
+  public void prepareForRetry() {
+    this.initResultNodeContext();
+  }
+
+  private void initResultNodeContext() {
+    this.resultNodeContext = new ResultNodeContext(queryId);
   }
 
   public QueryId getQueryId() {
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
index a471be8780..a6e7afa979 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
@@ -205,6 +205,8 @@ public class QueryExecution implements IQueryExecution {
     stateMachine.transitionToQueued();
     // force invalid PartitionCache
     partitionFetcher.invalidAllCache();
+    // clear runtime variables in MPPQueryContext
+    context.prepareForRetry();
     // re-analyze the query
     this.analysis = analyze(rawStatement, context, partitionFetcher, schemaFetcher);
     // re-start the QueryExecution