alpass163 commented on code in PR #18909:
URL: https://github.com/apache/iotdb/pull/18909#discussion_r4321451585
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/ProcedureExecutor.java:
##########
@@ -730,12 +746,70 @@ private LockStateResult<Env> executeRootStackRollback(
}
}
+ if (!proceduresKeepingTheirStates.isEmpty()) {
+ subprocStack.removeIf(proceduresKeepingTheirStates::contains);
+ proceduresKeepingTheirStates.forEach(this::finishWithoutRollback);
+ }
+
LOG.info(
ProcedureMessages.ROLLED_BACK_TIME_DURATION_IS, rootProcedure,
rootProcedure.elapsedTime());
rootProcedureCleanup(rootProcedure);
return new LockStateResult<>(ProcedureLockState.LOCK_ACQUIRED,
rootProcedure);
}
+ /**
+ * Finishes a procedure without undoing any of the states it has executed.
The failure is still
+ * reported, as the operation the procedure was part of did not complete;
what is dropped is only
+ * the bookkeeping of the rollback, so that neither this rollback nor the
one a new leader
+ * recovers touches this procedure again.
+ */
+ private void finishWithoutRollback(final Procedure<Env> procedure) {
+ procedure.abandonRollback();
+ if (!procedure.isSuccess()) {
+ procedure.setState(ProcedureState.ROLLEDBACK);
+ }
+ // The rollback loop skipped acquireLock() for this procedure, so a lock
restored by
+ // restoreLock() on load is still recorded in lockedWhenLoading instead of
locked. Finish that
+ // bookkeeping and release the lock here: rootProcedureCleanup() releases
only the locks that
+ // hasLock() reports, and a finished procedure must not keep holding its
lock.
+ if (procedure.hasLock() || procedure.isLockedWhenLoading()) {
+ if (acquireLock(procedure) == ProcedureLockState.LOCK_ACQUIRED) {
+ releaseLock(procedure, false);
Review Comment:
fixed it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]