Skip to content

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

Merged
madolson merged 9 commits into
redis: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 into
redis:unstablefrom
hpatro:fix-shardpubsub-cluster-replicate

Conversation

@hpatro

@hpatro hpatro commented Sep 14, 2023

Copy link
Copy Markdown
Contributor

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. 

@zuiderkwast zuiderkwast 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.

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.

Comment thread src/cluster.c Outdated
@hpatro

hpatro commented Sep 15, 2023

Copy link
Copy Markdown
Contributor Author

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.

Comment thread src/cluster.c Outdated
Comment thread src/cluster.c Outdated
Comment thread src/cluster.c Outdated
Comment thread src/cluster.c Outdated
Comment thread src/cluster.c Outdated
Comment thread src/cluster.c Outdated
Comment thread src/cluster.c
Co-authored-by: Madelyn Olson <34459052+madolson@users.noreply.github.com>
@madolson

Copy link
Copy Markdown
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