Closed EvgeniiVR closed 2 months ago
Yes, I am aware of that glitch, but was unsure of what to do in the case of a transaction failing in the middle of a single (of many) commit plugins. I am open to suggestion on how to address this, as long as it is backward compatible. Are you saying you would rather switch the plugin calls, so that abort is called before revert, and that would solve your problem? This could be done by adding an option. Another way would be to add (yet another) callback, called at the time of the first commit error.
Hello @olofhagsand, Was looking on abort callback as it is the only callback that run for the plugin after failed commit callback. But if it is possible to introduce special callback type that run once before the revert callback phase and only for the failed plugin - I believe it is the best way to resolve this glitch. Then there'll be a placeholder for the code to incrementally rollback "print" within the failed plugin.
OK, lets add a new callback. It should be straightforward, just follow the code of the other transaction callbacks, in case you want to make a PR?
yep, would like to follow with the PR. Do I need to create separate issue for the PR?
Yes, maybe you could add a separate issue to describe what to add and then reference that from a PR. Then I can close this discussion.
@olofhagsand I've created new PR w/ reference on this discussion https://github.com/clicon/clixon/issues/518 Thank you!
Hello team,
Is there any way to make clixon backend to run abort callback before revert?
Let me describe my concern in more details, we have 4 plugins, e.g. PLUGIN 1 PLUGIN 2 PLUGIN 3 PLUGIN 4 that run in the appropriate order. Let's say PLUGIN 4's commit callback fails with error:
Then backend starts in reverse order revert callbacks and then abort callbacks:
Revert callbacks run only for "successfully commited" plugins starting from PLUGIN 3->2->1. But in case PLUGIN 4 managed to leave any "print" on the system before it failed and from data/yang model prospective has references on previous plugins then we have to make some operations to clear that "print" before revert operations for PLUGIN 3->2->1 , but we don't have any place holder for that.