Skip to content

redis_proxy: fix SCAN command to comply with Redis specification (#42…#44070

Open
DhruvaD1 wants to merge 1 commit intoenvoyproxy:mainfrom
DhruvaD1:fix/redis-scan-spec-compliance
Open

redis_proxy: fix SCAN command to comply with Redis specification (#42…#44070
DhruvaD1 wants to merge 1 commit intoenvoyproxy:mainfrom
DhruvaD1:fix/redis-scan-spec-compliance

Conversation

@DhruvaD1
Copy link

…889)

Commit Message: redis_proxy: fix SCAN command to comply with Redis specification

Additional Description:

Previously, the Redis proxy SCAN command fanned out to all shards simultaneously and returned concatenated cursor/key pairs (one per shard), violating the Redis SCAN specification.

This fix routes SCAN to a single shard at a time using an encoded cursor format. When a shard finishes iteration, the proxy automatically goes to the next shard. The client receives a spec-compliant response at every step and only sees cursor "0" when all shards have been scanned.

The previous attempt at this fix (#43114) was closed without merging.

Risk Level: Medium

Testing:

Unit tests passing (213/213). 8 new tests for the single-shard path these cover cursor encoding, shard routing, shard advancement, last-shard completion, invalid cursor format, out-of-bounds shard index, upstream failure, and cancel. Verified the bug is real by running SCAN against a live 3-node Redis cluster through stock Envoy v1.37.1.

Docs Changes: None

Release Notes: Fixed Redis proxy SCAN to return spec-compliant responses in sharded clusters.

[Optional Fixes #Issue] #42889

@repokitteh-read-only
Copy link

Hi @DhruvaD1, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #44070 was opened by DhruvaD1.

see: more, trace.

@repokitteh-read-only
Copy link

CC @envoyproxy/runtime-guard-changes: FYI only for changes made to (source/common/runtime/runtime_features.cc).

🐱

Caused by: #44070 was opened by DhruvaD1.

see: more, trace.

@wbpcode
Copy link
Member

wbpcode commented Mar 25, 2026

gently ping @nezdolik as the redis code owner :)

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