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

Rollback preparation fails if required data have been deleted #210

Merged

Conversation

xirc
Copy link
Contributor

@xirc xirc commented May 26, 2023

Closes #206

Once data (events or snapshots) have been deleted, a rollback to a timestamp that requires such deleted data is impossible. This PR changes the rollback preparation (prepareRollback) such that it fails if required data have already been deleted.

The rollback preparation checks that each persistent actor can be rolled back (the persistent actor has a consistent state after rollback) based on sequence numbers. These checks involve the following component:

  • RollbackRequirementsVerifier: for each persistent actor, it verifies whether the rollback is possible.
  • PersistentActorRollback.findRollbackRequirements: for each persistent actor, it finds the possible lowest sequence number such that the persistent actor is consistent after rollbacks.
  • RollbackTimestampHintFinder: it finds a timestamp hint if the rollback is impossible. Rollbacks should specify a newer timestamp than the hint, at least. While the hint might need to be more strictly correct, it helps to know why the given timestamp-based rollback is impossible.

@xirc xirc added this to the v2.3.0 milestone May 26, 2023
@xirc xirc marked this pull request as ready for review May 26, 2023 08:08
@xirc xirc requested a review from negokaz May 26, 2023 08:16
Copy link
Contributor

@negokaz negokaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xirc
Great! I left a comment.

@xirc xirc force-pushed the rollback-preparation-fails-if-required-data-have-been-deleted branch from 1f9de2e to 9852948 Compare June 1, 2023 09:03
Copy link
Contributor

@negokaz negokaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! LGTM 👍

@negokaz negokaz enabled auto-merge June 1, 2023 10:34
@negokaz negokaz merged commit b00fd6a into master Jun 2, 2023
@negokaz negokaz deleted the rollback-preparation-fails-if-required-data-have-been-deleted branch June 2, 2023 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rollback should fail without no deletion if required events or snapshots have already been deleted
2 participants