Skip to content

Add CLIENT CAPA option for keyless read command redirection for non-readonly replicas#3505

Draft
yanamolo wants to merge 2 commits intovalkey-io:unstablefrom
yanamolo:improve-keyless-handling
Draft

Add CLIENT CAPA option for keyless read command redirection for non-readonly replicas#3505
yanamolo wants to merge 2 commits intovalkey-io:unstablefrom
yanamolo:improve-keyless-handling

Conversation

@yanamolo
Copy link
Copy Markdown
Contributor

Introduce a new client capability redirect-keyless that, when set, causes keyless read commands (e.g SCAN) to be redirected to the primary with a MOVED response when the client is connected to a replica and has not opted into replica reads via READONLY.

Previously, keyless commands were unconditionally excluded from cluster redirection logic. This made it impossible for smart clients to ensure all reads go to the primary without explicitly tracking which commands carry keys.

Changes:

  • Register the "redirect-keyless" capability in clientCapaCommand().
  • Redirect keyless read commands (including all-keyless EXEC) to the primary when the capability is set and READONLY is not active.
  • Update CLIENT HELP output to document the new capability.
  • Add integration tests covering redirection, READONLY bypass, non-read command passthrough, and CLIENT INFO reporting.

Closes #2991

…eadonly replicas

Signed-off-by: Yana Molodetsky <yamolodu@amazon.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 14, 2026

Codecov Report

❌ Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 76.42%. Comparing base (baa5a48) to head (a6a9955).
⚠️ Report is 2 commits behind head on unstable.

Files with missing lines Patch % Lines
src/server.c 93.33% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #3505      +/-   ##
============================================
- Coverage     76.48%   76.42%   -0.06%     
============================================
  Files           159      159              
  Lines         79815    79857      +42     
============================================
- Hits          61043    61028      -15     
- Misses        18772    18829      +57     
Files with missing lines Coverage Δ
src/networking.c 92.10% <100.00%> (-0.28%) ⬇️
src/server.h 100.00% <ø> (ø)
src/server.c 89.61% <93.33%> (+0.11%) ⬆️

... and 17 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Yana Molodetsky <yamolodu@amazon.com>
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.

Executing READONLY keyless commands on non-readonly replicas

1 participant