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

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


The following commit(s) were added to 
refs/heads/handle_redirection_during_dispatching by this push:
     new 94c814ec33 change the condition of redirection by query execution
94c814ec33 is described below

commit 94c814ec332683414bc23e437eaa4685a24f5284
Author: Tian Jiang <[email protected]>
AuthorDate: Tue May 16 12:02:06 2023 +0800

    change the condition of redirection by query execution
---
 .../java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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 0cac209f97..9c25cbbda0 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
@@ -661,8 +661,10 @@ public class QueryExecution implements IQueryExecution {
         && !analysis.isFinishQueryAfterAnalyze()
         && (!config.isEnable13DataInsertAdapt()
             || 
IoTDBConstant.ClientVersion.V_1_0.equals(context.getSession().getVersion()))
-        // if the status is already a redirection, do not modify it
-        && tsstatus.getCode() != 
TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) {
+        // only redirect here when a redirection is required but not knowing 
where, otherwise,
+        // the redirection from lower level may be overwritten
+        && (tsstatus.getCode() == 
TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()
+            && !tsstatus.isSetRedirectNode())) {
       InsertBaseStatement insertStatement = (InsertBaseStatement) 
analysis.getStatement();
       List<TEndPoint> redirectNodeList = analysis.getRedirectNodeList();
       if (insertStatement instanceof InsertRowsStatement

Reply via email to