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

Raise a SlotNotCoveredError in rediscluster if slot doesnt exist #833

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

justinmir
Copy link
Contributor

@justinmir justinmir commented Apr 5, 2024

💸 TL;DR

Fixes a bug that causes redis-cluster client to fail to refresh the topology when a failover occurs in the Redis cluster.

📜 Details

The redis-py-cluster library does not properly handle a KeyError from get_node_by_slot. In their code they convert KeyError's to SlotNotCoveredError triggering a topology refresh, we should do the same in our derived class that overrides get_node_by_slot.

See https://github.com/Grokzen/redis-py-cluster/blob/8a8102a9d758d61a7ec1e2ac9050fcd34029ff3f/rediscluster/connection.py#L378 for how this is implemented in the client library.

🧪 Testing Steps / Validation

Tested baseplate.py client in test pod connected to cluster performing failover.

✅ Checks

  • CI tests (if present) are passing
  • Adheres to code style for repo
  • Contributor License Agreement (CLA) completed if not a Reddit employee

@justinmir justinmir changed the title Raise a SlotNotCoveredError in rediscluster slot doesnt exist Raise a SlotNotCoveredError in rediscluster if slot doesnt exist Apr 5, 2024
@justinmir justinmir force-pushed the redis-cluster-fix branch 4 times, most recently from cc674b6 to fea09d5 Compare April 5, 2024 17:12
The redis-py-cluster library does not properly handle a KeyError from
`get_node_by_slot`. In their code they convert KeyError's to
`SlotNotCoveredError` triggering a topology refresh, we should do the
same in our derived class that overrides `get_node_by_slot`.

See https://github.com/Grokzen/redis-py-cluster/blob/8a8102a9d758d61a7ec1e2ac9050fcd34029ff3f/rediscluster/connection.py#L378
for how this is implemented in the client library.
@justinmir justinmir marked this pull request as ready for review April 5, 2024 19:43
@justinmir justinmir requested a review from a team as a code owner April 5, 2024 19:43
@chriskuehl chriskuehl merged commit 1580d0f into reddit:develop Apr 30, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants