VGalaxies commented on code in PR #12647:
URL: https://github.com/apache/iotdb/pull/12647#discussion_r1634145898
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/subscription/subscription/DropSubscriptionProcedure.java:
##########
@@ -242,44 +250,47 @@ protected void
rollbackFromOperateOnConfigNodes(ConfigNodeProcedureEnv env) {
env.getConfigManager()
.getConsensusManager()
.write(new AlterMultipleTopicsPlan(alterTopicRollbackPlans));
- } catch (ConsensusException e) {
+ } catch (final ConsensusException e) {
LOGGER.warn("Failed in the write API executing the consensus layer due
to: ", e);
response = new
TSStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode());
response.setMessage(e.getMessage());
}
- // if failed to rollback, throw exception
+ // If failed to rollback, throw exception
if (response.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
throw new SubscriptionException(response.getMessage());
}
- // Do nothing to rollback dropPipeProcedures
+ // Rollback AlterConsumerGroupProcedure
+ alterConsumerGroupProcedure.rollbackFromOperateOnConfigNodes(env);
}
@Override
- protected void rollbackFromOperateOnDataNodes(ConfigNodeProcedureEnv env)
throws IOException {
+ protected void rollbackFromOperateOnDataNodes(final ConfigNodeProcedureEnv
env)
Review Comment:
> Usually when we do rollback, we roll back from the last executed to the
first executed.
The DropSubscriptionProcedure has been appropriately modified. The
CreateSubscriptionProcedure will be modified in subsequent metadata
restructuring.
> Whether the drop subscription procedure needs to be rolled back may need
to be considered twice.
Before metadata restructuring, considering that the process of changing the
topic meta and consumer group meta involves multiple procedures, there could be
failures during execution. Therefore, it is currently necessary to consider
rolling back part of the procedure to ensure CN metadata consistency.
In the subsequent metadata restructuring, we will consider mapping the drop
subscription procedure to a single procedure. At that time we can consider not
performing rollback to prevent the occurrence of create subscription after the
rollback of drop subscription.
--
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]