fix(txpipeline): keyless commands should take the slot of the keyed#3411
Merged
fix(txpipeline): keyless commands should take the slot of the keyed#3411
Conversation
ndyakov
commented
Jun 19, 2025
Member
Author
|
@LINKIWI bringing this to your attention. |
b860a10 to
185ec01
Compare
7c977ea to
1683069
Compare
Add list of keyless Commands based on the Commands output for redis 8
1683069 to
49906ee
Compare
Contributor
Thanks, good catch. Structurally this looks good to me. I can help run this patch through our internal correctness and performance test suite early next week. |
LINKIWI
reviewed
Jun 20, 2025
Contributor
htemelski-oss
left a comment
There was a problem hiding this comment.
Overall looks good. Maybe we can improve the performance and the readability a bit
072d8d8 to
57a57be
Compare
57a57be to
2bbcdaa
Compare
htemelski-oss
previously approved these changes
Jun 23, 2025
htemelski-oss
previously approved these changes
Jun 23, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR ensures that keyless commands in a transaction pipeline use the same slot as keyed commands by introducing a preferred random slot concept and filtering keyed commands for slot determination.
- Extend
cmdSlotto accept apreferredRandomSlotand propagate it through the pipeline mapping logic - Add
slottedKeyedCommandshelper to group keyed commands by slot - Update tests to cover the preferred slot behavior and pipeline execution of keyless commands
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| ring_test.go | Adjusted Process-hook tests to invoke Get instead of Ping and updated expectations |
| osscluster_test.go | Added a test to verify keyless commands in a pipeline don’t trigger ErrCrossSlot |
| osscluster.go | Refactored slot resolution: added preferredRandomSlot parameter and slottedKeyedCommands |
| internal_test.go | Added tests for new preferredRandomSlot behavior in cmdSlot |
| command.go | Introduced keylessCommands map and updated cmdFirstKeyPos to recognize keyless commands |
Comments suppressed due to low confidence (1)
osscluster.go:1583
- [nitpick] The function name
slottedKeyedCommandsis a bit unclear. Consider renaming it tokeyedCommandsBySlotto more directly convey that it returns a map of slot → keyed commands.
func (c *ClusterClient) slottedKeyedCommands(cmds []Cmder) map[int][]Cmder {
htemelski-oss
approved these changes
Jun 24, 2025
ofekshenawa
pushed a commit
to ofekshenawa/go-redis
that referenced
this pull request
Jun 30, 2025
…edis#3411) * fix(txpipeline): keyless commands should take the slot of the keyed commands * fix(txpipeline): extract only keyed cmds from all cmds * chore(test): Add tests for keyless cmds and txpipeline * fix(cmdSlot): Add preferred random slot * fix(cmdSlot): Add shortlist of keyless cmds * chore(test): Fix ring test * fix(keylessCommands): Add list of keyless commands Add list of keyless Commands based on the Commands output for redis 8 * chore(txPipeline): refactor slottedCommands impl * fix(osscluster): typo
ofekshenawa
pushed a commit
to ofekshenawa/go-redis
that referenced
this pull request
Jun 30, 2025
…edis#3411) * fix(txpipeline): keyless commands should take the slot of the keyed commands * fix(txpipeline): extract only keyed cmds from all cmds * chore(test): Add tests for keyless cmds and txpipeline * fix(cmdSlot): Add preferred random slot * fix(cmdSlot): Add shortlist of keyless cmds * chore(test): Fix ring test * fix(keylessCommands): Add list of keyless commands Add list of keyless Commands based on the Commands output for redis 8 * chore(txPipeline): refactor slottedCommands impl * fix(osscluster): typo
ofekshenawa
pushed a commit
that referenced
this pull request
Aug 10, 2025
…3411) * fix(txpipeline): keyless commands should take the slot of the keyed commands * fix(txpipeline): extract only keyed cmds from all cmds * chore(test): Add tests for keyless cmds and txpipeline * fix(cmdSlot): Add preferred random slot * fix(cmdSlot): Add shortlist of keyless cmds * chore(test): Fix ring test * fix(keylessCommands): Add list of keyless commands Add list of keyless Commands based on the Commands output for redis 8 * chore(txPipeline): refactor slottedCommands impl * fix(osscluster): typo
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.
There is the possibility that there are keyless commands that can be executed on any node/slot. This should make sure that we choose the slot for the keyed commands when there is a tx pipelien request.