Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lemonlinger opened this issue Jan 9, 2025 · 0 comments
Open

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

lemonlinger opened this issue Jan 9, 2025 · 0 comments

Comments

@lemonlinger
Copy link

lemonlinger commented Jan 9, 2025

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

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

No branches or pull requests

1 participant