Skip to content
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

[4.x] make Command.create() return existing instance for known commands #414

Merged
merged 1 commit into from
Nov 13, 2023

Conversation

Ladicek
Copy link
Contributor

@Ladicek Ladicek commented Oct 19, 2023

When the Command.create() method is used to create a Command instance for a known command (not recommended, but also not forbidden), it used to return a generic instance that doesn't know anything about where the keys are in the command. Such generic instance is unusable with Redis cluster, because the target node will be selected randomly, not based on the key, and there's high chance such command will result in the MOVED redirect.

With this commit, Command.create() will return a pre-existing static instance for known commands, which is key-aware and works with Redis cluster.

This is a backport of #413 to the 4.x branch.

@Ladicek Ladicek requested review from vietj and pmlopes October 19, 2023 11:14
When the `Command.create()` method is used to create a `Command` instance
for a known command (not recommended, but also not forbidden), it used to
return a generic instance that doesn't know anything about where the keys
are in the command. Such generic instance is unusable with Redis cluster,
because the target node will be selected randomly, not based on the key,
and there's high chance such command will result in the `MOVED` redirect.

With this commit, `Command.create()` will return a pre-existing static
instance for known commands, which is key-aware and works with Redis cluster.
@Ladicek Ladicek changed the title make Command.create() return existing instance for known commands [4.x] make Command.create() return existing instance for known commands Oct 20, 2023
@vietj vietj merged commit cdffc70 into vert-x3:4.x Nov 13, 2023
4 checks passed
@vietj vietj added this to the 4.5.0 milestone Nov 13, 2023
@Ladicek Ladicek deleted the known-commands-4.x branch November 13, 2023 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants