-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add support for optional snapshots #7444
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
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
@@ -61,7 +62,9 @@ private EventsourcedState RecoveryStarted(long maxReplays) | |||
// protect against snapshot stalling forever because journal overloaded and such | |||
var timeout = Extension.JournalConfigFor(JournalPluginId).GetTimeSpan("recovery-event-timeout", null, false); | |||
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
{ | ||
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)