Skip to content

Read nil from a new-joined slave node in Redis cluster. #3222

@lemonlinger

Description

@lemonlinger

We enable ReadOnly=true for the Redis cluster client. When a new slave node joins the cluster, the client can quickly detect the new slave node by updating the cluster states. Once a new node is detected, requests are immediately forwarded to that node. If the new slave node is still in the master-slave replication process and is waiting for the master node to send the RDB file, the result of the client's read operation will be nil.

Expected Behavior

A new slave node should not be added to the cluster state before completing master-slave replication.

Current Behavior

When a slave node joins the cluster, it is immediately added to the cluster state to receive client requests.

Possible Solution

To check if a node is in replication state when loading cluster state. Send the command info replication to the slave node and add it into cluster state only when master_link_status is up.

Steps to Reproduce

  1. Setup a Redis cluster with at least one slave node for each shard.
  2. Fill a bulk of random data into the cluster. This is for extending the replication duration intentionally.
  3. Run a Redis cluster client (ReadOnly=true is enabled) to keep reading existing keys from the cluster.
  4. Add a slave node into the cluster.
  5. Check if the client reads nil values.

Context (Environment)

Detailed Description

Possible Implementation

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions