-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add support for optional snapshots #7444
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
|
Thank you very much @chrisjhoare - looks like there's just a markdown linting grumble but otherwise CI/CD seems happy. We'll review this shortly! |
2648d08 to
4da3bce
Compare
Aaronontheweb
left a comment
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.
LGTM
| Enable this feature by setting `snapshot-is-optional = true` in the snapshot store configuration. | ||
|
|
||
| > [!WARNING] | ||
| >Don't set `snapshot-is-optional = true` if events have been deleted because that would result in wrong recovered state if snapshot load fails. |
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.
LGTM
| var lpref = Sys.ActorOf(Props.Create(() => new SnapshotFailureRobustnessSpec.LoadSnapshotTestActor(Name, TestActor))); | ||
| ExpectMsg<Error>(m => m.Message.ToString().StartsWith("Error loading snapshot")); | ||
| ExpectMsg("boom-1"); | ||
| ExpectMsg<RecoveryCompleted>(); |
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.
LGTM
| var timeoutCancelable = Context.System.Scheduler.ScheduleTellOnceCancelable(timeout, Self, new RecoveryTick(true), Self); | ||
|
|
||
|
|
||
| var snapshotIsOptional = Extension.SnapshotStoreConfigFor(SnapshotPluginId).GetBoolean("snapshot-is-optional", false); |
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.
LGTM
| if (snapshotIsOptional) | ||
| { | ||
| OnRecoveryFailure(failed.Cause); | ||
| Log.Info("Snapshot load error for persistenceId [{0}]. Replaying all events since snapshot-is-optional=true", PersistenceId); |
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.
LGTM - might consider making this a WARNING but I think it's fine as-is for now
| # recover by replaying all events. | ||
| # Don't set to true if events are deleted because that would | ||
| # result in wrong recovered state if snapshot load fails. | ||
| snapshot-is-optional = false |
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.
LGTM
This is the implementation for allowing persistence snapshots to be optional when failing (issue #7382)
Changes
Setting snapshot-is-optional = true in the snapshot store configuration will allow Actors to continue if there is a failure loading the snapshot (https://doc.akka.io/libraries/akka-core/current//typed/persistence-snapshot.html#optional-snapshots)