-
Notifications
You must be signed in to change notification settings - Fork 459
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
Allow Write Operations when Slot is in MIGRATING state #474
Merged
vazois
merged 43 commits into
microsoft:main
from
vazois:vazois/allow-writes-during-migration
Jun 27, 2024
Merged
Allow Write Operations when Slot is in MIGRATING state #474
vazois
merged 43 commits into
microsoft:main
from
vazois:vazois/allow-writes-during-migration
Jun 27, 2024
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
be71b9d
to
0bad8ce
Compare
6975349
to
bd8b53a
Compare
badrishc
reviewed
Jun 27, 2024
badrishc
approved these changes
Jun 27, 2024
3531784
to
b300712
Compare
77343b9
to
4867248
Compare
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.
This PR resolves issue #354.
Tasks:
Overview of Migration
The process of slot migration involves several stages which are designed to manage data access, ensuring both data integrity and high availability as the corresponding keys are being transferred from the source node to the target node.
The MIGRATE command supports two transfer options, specifically MIGRATE KEYS and MIGRATE SLOTS.
Both options use a common data access control interface, that is logically divided into the following categories:
Used to orchestrate migration by changing the state of the associated slot accordingly (i.e. MIGRATING, IMPORTING) at the corresponding source and target nodes
Used to control access to individual keys in order to ensure high availability and data integrity.
Key level access control
Each migrate session maintains a dictionary of <keys, KeyMigrationStatus> pairs.
This dictionary is used to control access to keys that are actively being managed by a single running migrate session.
When a slot is in the process of migration and there are no active migration sessions managing a specific key, any requests for that key are handled under the assumption that the key exists. If it doesn’t, a redirect -ASK is created, which points to the endpoint of the target node.
The KeyMigrationStatus will affect individual session readers and writers as follows:
Key owned by a specific MigrateSession but is not actively being migrated.
Reads and writes can be served if the keys exist.
Key is actively being migrated by a specific MigrateSession.
Writes will be delayed until status goes back to QUEUED or MIGRATED.
Reads can be served without any restriction.
Key is being deleted after it was sent to the target node.
Reads and writes will be delayed.
We need to delay reads to avoid the scenario where a key exists during validation but was deleted before read executes.
Key owned by a specific MigrateSession and has completed all the steps to be MIGRATED to target node.
This does not mean that key existed or has not expired, just that all the steps associated with MIGRATED have completed.
This can happen for a key that was provided as an argument in MIGRATE command but did not exist or expired for both main and object stores.
Key Transfer State Machine Algorithm
RespClusterBench - Slot in STABLE state
Main
PR #474
Diff (%)
RespClusterMigrateBench - Slot in MIGRATING state
Main
PR #474
Diff (%)