Merged
Conversation
lvonk
reviewed
May 8, 2025
1b78c63 to
e5b3ad5
Compare
e5b3ad5 to
c4b8c54
Compare
To support changing the internals of an aggregate root without having to throw away the old snapshots the snapshot version can now be specified. This is needed to be able to support zero-downtime deployments, where both old and new code run concurrently using the same event store, but each may require different snapshots. Example usage: ``` enable_snapshots version: 2 ``` The default version is 1.
Pass snapshot version information when retrieving and storing snapshots from/to the database. A hash of aggregate types to supported snapshot version is passed on every call that needs it so the snapshot can be correctly selected. The default implementation queries all descendants of AggregateRoot for the supported snapshot version. This can be configured with the `aggregate_snapshot_versions` setting.
9e9490d to
b0375e2
Compare
When the snapshot format changes for an aggregate that needs snapshots, a new row is inserted into the `aggregates_that_need_snapshots` table with the updated version number. This will cause the snapshotter to select this aggregate to create a new snapshot with the new version.
This task should be executed when the new code is fully deployed to all machines, and the other snapshot versions are no longer required.
4ce3be6 to
91ba2f4
Compare
5a4296e to
616085c
Compare
07342b2 to
7294807
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To support changing the internals of an aggregate root without having
to throw away the old snapshots the snapshot version can now be
specified. This is needed to be able to support zero-downtime
deployments, where both old and new code run concurrently using the
same event store, but each may require different snapshots.
Example usage:
The default version is 1.
A hash mapping aggregate types to the supported snapshot version is
passed to every database call that needs it so the snapshot can be
correctly selected. The default implementation queries all descendants
of
AggregateRootfor the supported snapshot version. This can bechanged using the
aggregate_snapshot_versionsconfiguration setting.