From 0ebb0be15c328b65f711f13a107bbabc5b5c0e30 Mon Sep 17 00:00:00 2001 From: Peng Junzhi <201250214@smail.nju.edu.cn> Date: Mon, 18 Nov 2024 10:29:10 +0800 Subject: [PATCH] remove procedure no longer acquire node lock --- .../impl/node/RemoveDataNodesProcedure.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/node/RemoveDataNodesProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/node/RemoveDataNodesProcedure.java index 094e330eea97..027a6c04a019 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/node/RemoveDataNodesProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/node/RemoveDataNodesProcedure.java @@ -30,6 +30,7 @@ import org.apache.iotdb.confignode.procedure.exception.ProcedureException; import org.apache.iotdb.confignode.procedure.impl.region.RegionMigrateProcedure; import org.apache.iotdb.confignode.procedure.impl.region.RegionMigrationPlan; +import org.apache.iotdb.confignode.procedure.state.ProcedureLockState; import org.apache.iotdb.confignode.procedure.state.RemoveDataNodeState; import org.apache.iotdb.confignode.procedure.store.ProcedureType; @@ -70,6 +71,31 @@ public RemoveDataNodesProcedure( this.nodeStatusMap = nodeStatusMap; } + @Override + protected ProcedureLockState acquireLock(ConfigNodeProcedureEnv configNodeProcedureEnv) { + configNodeProcedureEnv.getSchedulerLock().lock(); + try { + LOG.info( + "procedureId {}-RemoveDataNodes skips acquiring lock, since upper layer ensures the serial execution.", + getProcId()); + return ProcedureLockState.LOCK_ACQUIRED; + } finally { + configNodeProcedureEnv.getSchedulerLock().unlock(); + } + } + + @Override + protected void releaseLock(ConfigNodeProcedureEnv configNodeProcedureEnv) { + configNodeProcedureEnv.getSchedulerLock().lock(); + try { + LOG.info( + "procedureId {}-RemoveDataNodes skips releasing lock, since it hasn't acquire any lock.", + getProcId()); + } finally { + configNodeProcedureEnv.getSchedulerLock().unlock(); + } + } + @Override protected Flow executeFromState(ConfigNodeProcedureEnv env, RemoveDataNodeState state) { if (removedDataNodes.isEmpty()) {