Skip to content

Unsubscribe all clients from replica for shard channel if the master ownership changes#12577

Merged
madolson merged 9 commits intoredis:unstablefrom
hpatro:fix-shardpubsub-cluster-replicate
Oct 13, 2023
Merged

Unsubscribe all clients from replica for shard channel if the master ownership changes#12577
madolson merged 9 commits intoredis:unstablefrom
hpatro:fix-shardpubsub-cluster-replicate

Conversation

@hpatro
Copy link
Contributor

@hpatro hpatro commented Sep 14, 2023

Fixes #12558

Release notes
Fix a bug where a replica would continue to serve slots it doesn't have data for after switching masters which owns different slots. 

Copy link
Contributor

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

It seems reasonable to unsubscribe clients from shard channels when the shard changes.

Do we ever do this for regular subscribe channels and patterns?

I'm not sure all clients can handle a 'sunsubscribe' message without first having sent a SUNSUBSCRIBE command. Maybe not even redis-cli can handle this. We should check.

We need to clarify in the docs that the client can receive 'sunsubscribe' messages even when they haven't sent SUNSUBSCRIBE.

@hpatro
Copy link
Contributor Author

hpatro commented Sep 15, 2023

Do we ever do this for regular subscribe channels and patterns?

No, not that I'm aware of.

I'm not sure all clients can handle a 'sunsubscribe' message without first having sent a SUNSUBSCRIBE command. Maybe not even redis-cli can handle this. We should check.

We need to clarify in the docs that the client can receive 'sunsubscribe' messages even when they haven't sent SUNSUBSCRIBE.

This is already the behavior when individual slots get migrated from one node to another. Node migration scenario wasn't covered. Yeah, we could document this for client(s) to take action (possibly disconnect and reconnect the client) and improve redis-cli first. I will follow up on both of these.

@madolson
Copy link
Contributor

Not back porting immediately as there is no immediate need. If it comes up, we can backport and release.

@madolson madolson added the release-notes indication that this issue needs to be mentioned in the release notes label Oct 12, 2023
@madolson madolson merged commit b784c53 into redis:unstable Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes indication that this issue needs to be mentioned in the release notes

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] redis client do not recieve sunsubscribe when slave redis node replicate another master

4 participants