-
Notifications
You must be signed in to change notification settings - Fork 45
omdb: add facility for abandoning a saga #7791
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
Conversation
be46c6b
to
397d5d7
Compare
397d5d7
to
f1868f0
Compare
I've rebased onto the latest main and retested as noted in the PR description. I feel like I might be under-testing this a bit, so am especially open to suggestions for other things to try here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Two minor suggestions here but it looks good.
it will not resume executing the saga. | ||
|
||
- Other Nexuses will not adopt and resume the saga, even if its current assigned | ||
Nexus is removed from the system. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nexus is removed from the system. | |
Nexus is expunged. |
If the saga's current Nexus is actively driving it, the saga will continue to | ||
execute even if it is abandoned. You should only proceed if: | ||
|
||
- you've stopped the saga's assigned Nexus and are prepared to undo any changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- you've stopped the saga's assigned Nexus and are prepared to undo any changes | |
- you've stopped the saga's assigned Nexus AND are prepared to undo any changes |
/// If this status indicates that the relevant SEC might be active, returns | ||
/// `Err`. If the relevant SEC is thought to be inactive, or the saga used | ||
/// to produce this status had no SEC, returns `Ok`. | ||
fn as_result(self) -> anyhow::Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits: should probably be into_result
since this consumes self
. Also, the doc comment could be a little clearer about what's returned here: it's Ok
if there's sufficient evidence to be confident that this saga doesn't belong to an active SEC and Err
otherwise.
Define an "abandoned" saga state. An abandoned saga will not begin to be executed by any SEC. Technicians mark sagas as abandoned using omdb; this requires the saga's current executor not to be running (otherwise it could receive a state update from Steno that will clobber the Abandoned state). This commit defines the new state in the database schema and fixes up the DB crates accordingly, but adds no affordances for applying the new saga state or considering it when deciding what sagas to recover.
f1868f0
to
59026d4
Compare
Add an
Abandoned
saga state. This state disqualifies a saga from being picked up by Nexus saga recovery. (A running saga will continue running if it is Abandoned, and continued saga execution may end up clobbering the Abandoned state entirely.) Add anomdb
subcommand to move a saga to this state (and refactor a bit to avoid duplicating code with theinject-error
subcommand).Tested (so far) by:
svcadm restart
), but is no longer recovered once abandoned (and can't be completed anymore); if I manually move the saga back to Running and restart its SEC again, the saga is picked up normally.Fixes #7730.