Skip to content

Implement RedisClient::Cluster::Command#extract_all_keys #312

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

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

KJTsanaktsidis
Copy link
Contributor

This is required to validate that all the keys passed in to a pinned connection are consistent with the key passed in to #with. Technically speaking, we could let the Redis server just reject keys that are cross-node. However, there is a good reason to perform the validation in the client.

Redis clusters have 16,000 odd slots, but usually only a handful of nodes. It's quite possible you might create a transaction which operates across slots, but have it work fine because the slots just happen to hash to the same node. However, if a resharding event then happens, suddednly your working-fine code will break! It's nice for users to receive feedback straight away, even on very small development setups, that their cross-slot transactions may well not actually work later on.

This is required to validate that all the keys passed in to a pinned
connection are consistent with the key passed in to `#with`. Technically
speaking, we _could_ let the Redis server just reject keys that are
cross-node. However, there _is_ a good reason to perform the validation
in the client.

Redis clusters have 16,000 odd slots, but usually only a handful of
nodes. It's quite possible you might create a transaction which operates
across slots, but have it work fine because the slots just happen to
hash to the same node. However, if a resharding event then happens,
suddednly your working-fine code will break! It's nice for users to
receive feedback straight away, even on very small development setups,
that their cross-slot transactions may well not actually work later on.
Copy link
Member

@supercaracal supercaracal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand. Thank you!

@supercaracal supercaracal merged commit 9b640c5 into redis-rb:master Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants