Track projectors state (replaying/activating/active) in the database#472
Merged
erikrozendaal merged 15 commits intomasterfrom Jun 20, 2025
Merged
Track projectors state (replaying/activating/active) in the database#472erikrozendaal merged 15 commits intomasterfrom
erikrozendaal merged 15 commits intomasterfrom
Conversation
New is a bit confusing, since normally it refers to the current version of the running system. Only when running view schema migrations is new vs old version relevant.
lvonk
reviewed
Jun 11, 2025
lib/sequent/core/transactions/read_only_active_record_transaction_provider.rb
Show resolved
Hide resolved
| process_events | ||
| end | ||
|
|
||
| def replay_events(events) |
Member
There was a problem hiding this comment.
Maybe this should be in an EventReplayer or so?
lvonk
reviewed
Jun 11, 2025
During activation the last existing events are replayed before the projector is marked active. Block new events since they will not be picked up by the replay process.
Use `EventStore#replay_events_from_cursor` instead.
As long as the projector_states table is empty it is assumed the current Sequent configuration is correct. This allows easier unit testing (since there is no need to activate a configuration every time it changes in the test) and allows for backwards compatibility with the current deployment process (using online and offline migration).
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.
The event publisher and projector check the current state when processing events to:
NewerProjectorIsActiveErrorerrors.This PR is another step towards allowing rolling upgrades, where version N and version N+1 code is running concurrently during an upgrade, without affecting any users.
TODO
activate_current_configuration!