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

Fix producing illegal snapshot when compaction and adding a new event same time #115

Conversation

negokaz
Copy link
Contributor

@negokaz negokaz commented Dec 28, 2021

Closes #111

@negokaz negokaz force-pushed the fix-illegal-snapshot-when-compaction-and-adding-a-new-event-same-time branch 3 times, most recently from 1c05719 to 99afb87 Compare December 28, 2021 08:50
instead of actor supervisor

We should make RaftActor send Activate message to an entity at every launching the entity
RaftActor can send TakeSnapshot message during entity recovery.
Index of the snapshot is determined by lastApplied at sending TakeSnapshot.
RaftActor can provide new events to the entity during entity recovery and this process increments lastApplied.
RecoveryState message to recovery the entity is created from lastApplied.

These will cause a mismatch of the index of the snapshot and recovered state of the entity.
For more details, see #111.

The Activate message allows RaftActor to restore the state at just RaftActor creates the entity.
@negokaz negokaz force-pushed the fix-illegal-snapshot-when-compaction-and-adding-a-new-event-same-time branch from 5dcfb9e to 7bbe324 Compare December 29, 2021 01:28
The TestKit wil respond all log entries.
This implies recoveryIndex of Activate message was lastLogIndex.
@negokaz negokaz force-pushed the fix-illegal-snapshot-when-compaction-and-adding-a-new-event-same-time branch from deca752 to a9147f9 Compare December 29, 2021 08:33
@tksugimoto tksugimoto merged commit 9d9adaf into master Dec 29, 2021
@tksugimoto tksugimoto deleted the fix-illegal-snapshot-when-compaction-and-adding-a-new-event-same-time branch December 29, 2021 12:34
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.

ReplicatedEntity can produce illegal snapshot if compaction and receiving new event occur same time
2 participants