Handle ASK redirects to uncached cluster nodes#4070
Open
Sean-Kenneth-Doherty wants to merge 1 commit into
Open
Handle ASK redirects to uncached cluster nodes#4070Sean-Kenneth-Doherty wants to merge 1 commit into
Sean-Kenneth-Doherty wants to merge 1 commit into
Conversation
|
Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset. In case there are security findings, they will be communicated to you as a comment inside the PR. Hope you’ll enjoy using Jit. Questions? Comments? Want to learn more? Get in touch with us. |
15fc46e to
984e2eb
Compare
Author
|
Fresh local validation on the current branch:
I removed the temporary |
Collaborator
|
Hi @Sean-Kenneth-Doherty thank you for your contribution! I will have a look at it. |
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.
Summary
ASKINGFixes #4015.
Validation
TMPDIR=$PWD/.tmp PIP_CACHE_DIR=$PWD/.tmp/pip-cache uv run --with-requirements dev_requirements.txt pytest tests/test_cluster.py::TestRedisClusterObj::test_ask_redirection_to_uncached_node tests/test_asyncio/test_cluster.py::TestRedisClusterObj::test_ask_redirection_to_uncached_node -qTMPDIR=$PWD/.tmp PIP_CACHE_DIR=$PWD/.tmp/pip-cache uv run --with-requirements dev_requirements.txt ruff check redis/cluster.py redis/asyncio/cluster.py tests/test_cluster.py tests/test_asyncio/test_cluster.pyTMPDIR=$PWD/.tmp PIP_CACHE_DIR=$PWD/.tmp/pip-cache uv run --with-requirements dev_requirements.txt ruff format --check redis/cluster.py redis/asyncio/cluster.py tests/test_cluster.py tests/test_asyncio/test_cluster.pygit diff --check origin/master...HEADNote: broader cluster-object test classes require the repository's Docker-backed Redis Cluster dev environment and were not usable as local proof here; the new regressions are mocked and passed locally.
Assisted-by: OpenAI Codex
Note
Medium Risk
Changes cluster redirection behavior by creating/caching nodes on-the-fly during
ASKhandling in both sync and asyncio clients, which can affect routing and node cache consistency under topology edge cases.Overview
Fixes
ASKredirection when the target node is not present in the current cluster topology by introducingNodesManager.get_or_create_node()and using it in both sync (redis/cluster.py) and asyncio (redis/asyncio/cluster.py)AskErrorhandling before issuingASKING.Adds sync and asyncio regression tests that simulate an
ASKredirect to an uncached (zero-slot) node and assert the node is cached as aPRIMARYand the redirected command succeeds.Reviewed by Cursor Bugbot for commit 984e2eb. Bugbot is set up for automated code reviews on this repo. Configure here.