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

Cluster pub/sub: keyspace notification issues #789

Closed
klords opened this issue Mar 1, 2018 · 3 comments · May be fixed by #1536
Closed

Cluster pub/sub: keyspace notification issues #789

klords opened this issue Mar 1, 2018 · 3 comments · May be fixed by #1536

Comments

@klords
Copy link

klords commented Mar 1, 2018

Hoping this is just something I'm doing wrong, but I have a cluster with two master-slaves. I've found I'm unable to use a pattern subscription because it just subscribes to one master's notifications (and redis doesn't broadcast notifications across cluster by design). I tried subscribing with a few individual keys that I know are on different masters and only one subset of that group is coming back. I'm not sure if this is because of a slot miscalculation or what.

A way to remedy this would be to allow manual endpoint selection at subscription, but endpoint selection seems to be done automatically based on channel during subscription.

@klords
Copy link
Author

klords commented Mar 6, 2018

I can't imagine I'm the first to want to use a pattern subscription to keyspace notifications in a cluster. Is there a workaround for this using this client?

@mgravell
Copy link
Collaborator

mgravell commented Mar 6, 2018

For regular pub/sub (done manually), the events propagate around all nodes in the cluster, so it is only necessary to subscribe to a single node. Becuase of this, SE.Redis essentially uses a hash of the channel name to choose a node arbitrarily, and it will get the message.

It sounds like keyspace notifications do not propagate, which is causing this confusion. I can see two possible fixes for this:

  1. detect and special-case the keyspace notification keys, and subscribe to all primary nodes
  2. implement a new API specifically to make keyspace notifications a first-class citizen in the API

(or, of course: both)

This doesn't exist today, but i certainly something that we could look at.

@NickCraver
Copy link
Collaborator

I'm going to close this out since a PR is open (and welcome!). Going through issues first, but #813 with some efficiency tweaks and tests added seems very appealing to me. Thanks for kicking this off @klords :)

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

Successfully merging a pull request may close this issue.

3 participants