Skip to content

fix(redis): require primary command routing - #11484

Merged
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:rb-fix-redis-primary-command-routing-617
Oct 14, 2026
Merged

ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:rb-fix-redis-primary-command-routing-617

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Redis membership and grain-directory scripts can be routed to a connected replica while the primary reconnects because StackExchange.Redis permits replica routing for EVAL/EVALSHA. Replicas reject these writes with READONLY errors, and replica-served membership snapshots or directory lookups can expose stale state.

Require CommandFlags.DemandMaster for membership scripts and snapshots, and for grain-directory registration/unregistration scripts and lookups. Preserve NoScriptCache on membership scripts and the established primary-only routing of native write commands. This enforces the providers' existing write and current-registration guarantees using their existing contracts.

Reuses the verified five-file correction published in #11476, applied to current main. Regression coverage captures the actual command flags and preserves cancellation, ownership, and cleanup-race behavior.

Fixes #11473.

Related proposal: #11476.

Microsoft Reviewers: Open in CodeFlow

Copilot AI balanced review requested due to automatic review settings October 13, 2026 09:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused routing correction is consistent across affected operations and has targeted regression coverage.

0 open findings

What changed in this PR

Ensures Redis membership and grain-directory operations route to the primary, preventing replica READONLY errors and stale reads.

Changes:

  • Adds DemandMaster while preserving NoScriptCache.
  • Routes directory lookups and membership snapshots to the primary.
  • Adds regression coverage for command flags and existing cancellation behavior.
File Description
RedisGrainDirectory.cs Enforces primary routing for directory operations.
RedisMembershipTable.cs Enforces primary routing for membership commands.
RedisGrainDirectoryUnitTests.cs Tests directory routing flags.
RedisMembershipTableTests.cs Updates cleanup integration coverage.
RedisMembershipTableCancellationTests.cs Tests membership flags and cancellation behavior.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown
Contributor

Code coverage

Metric Pull request Current main Variance
Lines 83.43% (118,557 / 142,098) 83.48% (118,615 / 142,096) -0.0420 pp
Branches 73.02% (35,274 / 48,308) 73.06% (35,296 / 48,308) -0.0455 pp

Report-only conclusion: regressed.

The current-main baseline is commit 1d9abaa1a2 and uses the same reviewed coverage matrix.

Coverage combines every CI test matrix job, including providers, CodeGen, .NET 8/10, Linux, Windows, and macOS, using canonical physical source and branch identities.

The comparison remains report-only while normal line and branch variance is calibrated.

Coverage details

@ReubenBond
ReubenBond merged commit bdc6d4f into dotnet:main Oct 14, 2026
94 checks passed
@ReubenBond
ReubenBond deleted the rb-fix-redis-primary-command-routing-617 branch October 14, 2026 14:25
ReubenBond added a commit to ReubenBond/orleans that referenced this pull request Oct 22, 2026
(cherry picked from commit bdc6d4f)

Upstream-PR: dotnet#11484
Upstream-Commit: bdc6d4f
ReubenBond added a commit that referenced this pull request Oct 23, 2026
(cherry picked from commit bdc6d4f)

Upstream-PR: #11484
Upstream-Commit: bdc6d4f
This was referenced Oct 29, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redis clustering and grain directory can route EVAL/EXEC to a read replica (READONLY) under StackExchange.Redis PreferMaster

2 participants