Core: SlotMap refactor - Added NodesMap, Update the slot map upon MOVED errors #2682
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.
Description
This PR was previously reviewed in our redis-rs fork at amazon-contributing/redis-rs#190 but was on hold due to lock issues. The recently merged PR #2643 addresses the encountered lock issues, making this PR now ready for merging.
This pull request introduces two significant updates:
SlotMap Refactor: The SlotMap structure has been updated with the addition of a
NodesMap
, which allows shard addresses to be shared between shard nodes and slot map values. This refactor optimizes how shard information is managed. For a detailed explanation, refer to PR #185.The diagram on the left illustrates the current SlotMap design, while the diagram on the right shows the newly implemented structure:

MOVED Error Handling: Logic has been added to update the slot map in response to
MOVED
errors. Previously, this was handled only during refresh_slots operations. With this change, the slot map is updated immediately upon encountering aMOVED
error. More information can be found in PR #186.Issue link
This Pull Request is linked to issue (URL): closes #2123
Checklist
Before submitting the PR make sure the following are checked: