Repository navigation
fix: make slot migration work end to end - #451
Merged
Merged
Conversation
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.
Resharding didn't work. This fixes the audit's MIGRATE bug and the orphaned-keys bug, plus three more problems found along the way.
What was wrong
MOVED, and every MIGRATE of a key failed.COPYwas parsed but the local key was deleted anyway.GETKEYSINSLOTlisted it again forever. If the loop did end, the CLI still reassigned the slot that held the key.What changed
MIGRATE pipelines
[AUTH] ASKING RESTOREto the target and reads every reply. It takesAUTH passwordandAUTH2 username password, as Redis does. It honorsCOPY, and repliesNOKEYfor a missing key, also as in Redis.check_slot_with_migrationreturns aSlotCheckenum. For a migrating slot it returnsAskIfMissing, and the connection layer then asks the shards which of the command's keys still exist:ASK;TRYAGAIN, as Redis Cluster does.This replaces the per-slot set of migrated keys, which grew with every key moved. The migration now keeps only a count.
ember-cli cluster reshardpasses-ato MIGRATE asAUTH, treatsNOKEYas moved, and stops with an error on a key it can't move, leaving that slot with the source.Tests
New integration tests:
MOVED.MIGRATE ... COPYkeeps the local key.NOAUTHwithout AUTH, and the key stays put; it succeeds withAUTH pw.ember-cli cluster reshardmoves 5 slots with 10 keys and leaves none behind. Against main, this loop never ends.The coordinator's unit tests are updated for
SlotCheck.Not covered: MIGRATE's
KEYSform for several keys, whichredis-cli --clusteruses. Onlyember-clireshard is supported.