-
Notifications
You must be signed in to change notification settings - Fork 1
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 old snapshot read in consecutive snapshot synchronization #217
Merged
negokaz
merged 12 commits into
master
from
fix-old-snapshot-read-in-consecutive-snapshot-synchronization
Nov 6, 2023
Merged
Fix old snapshot read in consecutive snapshot synchronization #217
negokaz
merged 12 commits into
master
from
fix-old-snapshot-read-in-consecutive-snapshot-synchronization
Nov 6, 2023
Conversation
This file contains 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
State transition will depend on callers of the state update function.
RaftActor of the source replica group of the synchronization can execute compactions during snapshot synchronization. In such a case, the single SnapshotSyncManager instance could perform multiple snapshot synchronizations in serial order. If the SnapsotSyncManager does so, it could read an old snapshot in the newer synchronization. This old snapshot read is related to the following aspects: * SnapshotSyncManager reads snapshots from a SnapshotStore that the SnapshotSyncManager spawns as its descendant. The SnapshotStore is a different instance from a SnapshotStore running as a descendant of RaftActor of the source replica group. The SnapshotStore cannot read new snapshots the other one wrote (by such as compaction) if it has already recovered from persisted data. * SnapshotSyncManager reuses an instance of SnapshotStore among multiple snapshot synchronizations. It cannot read a new snapshot written by a compaction that happens during the synchronization. Change SnapshotSyncManager such that it executes only one snapshot synchronization in its lifecycle. That means SnapshotSyncManager doesn't reuse SnapshotStore instances. Each synchronization will be performed by a different SnapshotSyncManager instance and in serial order.
SnapshotSyncManager no longer needs the Stop messages. It can decide immediately to stop itself in the finalizing state.
xirc
commented
Oct 26, 2023
core/src/main/scala/lerna/akka/entityreplication/raft/snapshot/sync/SnapshotSyncManager.scala
Show resolved
Hide resolved
Use SnapshotSyncManagerFinalizingSpec instead. It will contain tests for non-persistence features in the finalizing state.
…hot-synchronization
negokaz
reviewed
Oct 31, 2023
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.
Great! 👍 I left some comments.
...cala/lerna/akka/entityreplication/raft/snapshot/sync/SnapshotSyncManagerFinalizingSpec.scala
Outdated
Show resolved
Hide resolved
...cala/lerna/akka/entityreplication/raft/snapshot/sync/SnapshotSyncManagerFinalizingSpec.scala
Show resolved
Hide resolved
...src/test/scala/lerna/akka/entityreplication/raft/snapshot/sync/SnapshotSyncManagerSpec.scala
Show resolved
Hide resolved
negokaz
approved these changes
Nov 6, 2023
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 👍
negokaz
deleted the
fix-old-snapshot-read-in-consecutive-snapshot-synchronization
branch
November 6, 2023 01:12
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.
Closes #215
Changes SnapshotSyncManager such that it executes only one snapshotsynchronization in its lifecycle. That means SnapshotSyncManager doesn't reuse SnapshotStore instances. Each synchronization will be performed by a different SnapshotSyncManager instance and in serial order.
TODO: