This is an automated email from the ASF dual-hosted git repository.
rong 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 897e989261d Fixed the bug that procedure rollback may generate NPE &&
some of the rollback steps may not be / be extra executed (#14871)
897e989261d is described below
commit 897e989261dcd096b5a0f3fccac6a37172434b65
Author: Caideyipi <[email protected]>
AuthorDate: Thu Feb 20 11:47:46 2025 +0800
Fixed the bug that procedure rollback may generate NPE && some of the
rollback steps may not be / be extra executed (#14871)
---
.../iotdb/confignode/procedure/impl/StateMachineProcedure.java | 7 ++++++-
.../procedure/impl/schema/AlterLogicalViewProcedure.java | 4 +++-
2 files changed, 9 insertions(+), 2 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 ae2984c4166..1a925b77fc0 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
@@ -153,13 +153,18 @@ public abstract class StateMachineProcedure<Env, TState>
extends Procedure<Env>
}
TState state = getCurrentState();
+
+ // init for the first execution
if (states.isEmpty()) {
setNextState(getStateId(state));
+ addNextStateAndCalculateCycles();
}
LOG.trace("{}", this);
stateFlow = executeFromState(env, state);
- addNextStateAndCalculateCycles();
+ if (!isFailed()) {
+ addNextStateAndCalculateCycles();
+ }
setStateDeserialized(false);
if (!subProcList.isEmpty()) {
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterLogicalViewProcedure.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterLogicalViewProcedure.java
index b0210944d11..e81df1e558a 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterLogicalViewProcedure.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterLogicalViewProcedure.java
@@ -216,7 +216,9 @@ public class AlterLogicalViewProcedure
protected void rollbackState(
final ConfigNodeProcedureEnv env, final AlterLogicalViewState
alterLogicalViewState)
throws IOException, InterruptedException, ProcedureException {
- invalidateCache(env);
+ if (alterLogicalViewState ==
AlterLogicalViewState.CLEAN_DATANODE_SCHEMA_CACHE) {
+ invalidateCache(env);
+ }
}
@Override