You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ta...@apache.org on 2025/02/26 12:05:01 UTC

(iotdb) branch dev/1.3 updated: Fix state setting of AbstractOperatePipeProcedureV2 & Enhance state checking of StateMachineProcedure #14959 (#14961)

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

tanxinyu pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/dev/1.3 by this push:
     new f5c8fbe5786 Fix state setting of AbstractOperatePipeProcedureV2 & Enhance state checking of StateMachineProcedure #14959 (#14961)
f5c8fbe5786 is described below

commit f5c8fbe5786e3dae9326d47435fab47a653fdc1e
Author: Li Yu Heng <li...@126.com>
AuthorDate: Wed Feb 26 20:04:56 2025 +0800

    Fix state setting of AbstractOperatePipeProcedureV2 & Enhance state checking of StateMachineProcedure #14959 (#14961)
    
    (cherry picked from commit fb2cb7a394be50c7337e68bdc3838a0062ea3769)
---
 .../iotdb/confignode/procedure/impl/StateMachineProcedure.java   | 9 ++++++---
 .../procedure/impl/pipe/AbstractOperatePipeProcedureV2.java      | 2 ++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/StateMachineProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/StateMachineProcedure.java
index 189a57d5e11..f0d629a9819 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/StateMachineProcedure.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/StateMachineProcedure.java
@@ -183,12 +183,15 @@ public abstract class StateMachineProcedure<Env, TState> extends Procedure<Env>
     if (Flow.HAS_MORE_STATE == stateFlow) {
       if (nextState == NO_NEXT_STATE) {
         LOG.error(
-            "StateMachineProcedure pid={} not set next state, but return HAS_MORE_STATE",
-            getProcId());
+            "StateMachineProcedure pid={} not set next state, but return HAS_MORE_STATE. It is likely that there is some problem with the code. Please check the code. This procedure is about to be terminated: {}",
+            getProcId(),
+            this);
+        stateFlow = Flow.NO_MORE_STATE;
       } else {
         stateToBeAdded = nextState;
       }
-    } else {
+    }
+    if (Flow.NO_MORE_STATE == stateFlow) {
       if (nextState != NO_NEXT_STATE) {
         LOG.warn(
             "StateMachineProcedure pid={} set next state to {}, but return NO_MORE_STATE",
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/pipe/AbstractOperatePipeProcedureV2.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/pipe/AbstractOperatePipeProcedureV2.java
index ec0a33ee677..1da3bac41a0 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/pipe/AbstractOperatePipeProcedureV2.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/pipe/AbstractOperatePipeProcedureV2.java
@@ -265,6 +265,7 @@ public abstract class AbstractOperatePipeProcedureV2
             getCycles() + 1,
             RETRY_THRESHOLD,
             e);
+        setNextState(getCurrentState());
         // Wait 3s for next retry
         TimeUnit.MILLISECONDS.sleep(3000L);
       } else {
@@ -280,6 +281,7 @@ public abstract class AbstractOperatePipeProcedureV2
                 String.format(
                     "ProcedureId %s: Fail to %s because %s",
                     getProcId(), getOperation().name(), e.getMessage())));
+        return Flow.NO_MORE_STATE;
       }
     }
     return Flow.HAS_MORE_STATE;