Skip to content

Commit

Permalink
remove procedure no longer acquire node lock (#14115)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pengzna authored Nov 22, 2024
1 parent 7852cb6 commit 6242d93
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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()) {
Expand Down

0 comments on commit 6242d93

Please sign in to comment.