Skip to content

Align READONLY and READWRITE with Redis cluster semantics - #2109

Open
Vasileios Zois (vazois) wants to merge 5 commits into
mainfrom
vazois/rw-semantics-fix
Open

Align READONLY and READWRITE with Redis cluster semantics#2109
Vasileios Zois (vazois) wants to merge 5 commits into
mainfrom
vazois/rw-semantics-fix

Conversation

@vazois

Copy link
Copy Markdown
Contributor

Description

Aligns Garnet's cluster READONLY and READWRITE behavior with Redis semantics:

  • Replica reads redirect to the primary by default; READONLY enables replica-local reads for slots owned by its primary, and READWRITE restores default redirection.
  • Client writes remain redirected from replicas regardless of connection read mode.
  • Internal AOF replay write access is isolated from client session state, including replica FLUSHDB and FLUSHALL handling.
  • CONFIG GET slave-read-only reports the fixed replica write policy as yes.
  • Cluster test connections issue READONLY after connect and reconnect so existing replica-local validation remains explicit and stable.

Fixes #2086
Fixes #2087

@vazois
Vasileios Zois (vazois) marked this pull request as ready for review September 8, 2026 21:33
Copilot AI balanced review requested due to automatic review settings September 8, 2026 21:33

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.

🟡 Changes recommended

The public IClusterSession source-breaking change must be preserved compatibly or explicitly documented as breaking.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Aligns replica read/write behavior with Redis semantics while isolating internal AOF replay permissions.

Changes:

  • Makes READONLY control replica-local reads only; client writes always redirect.
  • Adds an internal replay-write capability and fixed slave-read-only=yes.
  • Updates tests and documentation.

Metadata: Description is accurate. Recommended title: [Cluster] Align READONLY and READWRITE with Redis cluster semantics.

File summaries
File Description
website/docs/commands/cluster.md Clarifies command semantics.
website/docs/cluster/replication.md Updates replica usage guidance.
test/standalone/Garnet.test/RespConfigTests.cs Verifies fixed config value.
test/standalone/Garnet.test/RespAdminCommandsTests.cs Updates config expectation.
test/cluster/Garnet.test.cluster/ClusterTestUtils.cs Enables replica reads in tests.
test/cluster/Garnet.test.cluster/ClusterRedirectTests.cs Tests read-mode redirects.
test/cluster/Garnet.test.cluster.replication/ReplicationTests/ClusterReplicationBaseTests.cs Tests failover write rejection.
libs/server/ServerConfig.cs Returns fixed replica policy.
libs/server/Resp/BasicCommands.cs Restricts flushes to internal replay.
libs/server/Config/RuntimeServerConfig.cs Updates config documentation.
libs/server/Cluster/IClusterSession.cs Revises session capability API.
libs/server/AOF/AofProcessor.cs Grants internal replay writes.
libs/resources/RespCommandsDocs.json Corrects READWRITE summary.
libs/cluster/Session/SlotVerification/ClusterSlotVerify.cs Separates read and write permissions.
libs/cluster/Session/MigrateCommand.cs Updates locality argument naming.
libs/cluster/Session/ClusterSession.cs Stores separate session flags.
libs/cluster/Server/Replication/ReplicaOps/ReplicaDisklessSync.cs Enables diskless replay writes.
libs/cluster/Server/Replication/ReplicaOps/ReplicaDiskbasedSync.cs Enables disk-based replay writes.
libs/cluster/Server/ClusterManagerSlotState.cs Updates locality calls.
libs/cluster/Server/ClusterConfig.cs Renames replica-read locality control.
Review details
  • Files reviewed: 20/20 changed files
  • Comments generated: 1
  • Review effort level: Balanced

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

Comment thread libs/server/Cluster/IClusterSession.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants