Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[remove datanode] Procedure no longer acquires node lock #14115

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading