-
Notifications
You must be signed in to change notification settings - Fork 955
Fixed CROSSSLOT ERROR in Cluster Mode for PUBSUB SHARDNUMSUB #1369
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
Conversation
Signed-off-by: Nikhil Manglore <[email protected]>
hpatro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nikhil-Manglore Could you also add test case for it?
zuiderkwast
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the issue, we marked it as a breaking change, so should we release it in a major version, 9.0? Or should we consider it a bugfix and release it in 8.1? @valkey-io/core-team I guess we should decide.
|
It's undeniably a breaking change, since we are throwing errors when something used to work. It should go with 9.0. |
Signed-off-by: Nikhil Manglore <[email protected]>
|
@Nikhil-Manglore Since this is a breaking change, we will release it only in the next major version, which is 9.0. This means that we can't merge it until after we've branched off for the 8.1 release. We'll do that around January or February. Sorry for the inconvenience. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #1369 +/- ##
============================================
+ Coverage 70.69% 70.81% +0.12%
============================================
Files 118 118
Lines 63549 63549
============================================
+ Hits 44924 45005 +81
+ Misses 18625 18544 -81
🚀 New features to boost your workflow:
|
Signed-off-by: Nikhil Manglore <[email protected]>
|
When writing the test cases in tcl I realized there was an issue with the keyspecs in my original code. I fixed that issue by changing the starting position and then tested it with the testcases. This gave the proper results and i have pushed the final changes including the tcl testcases. |
|
@Nikhil-Manglore Thanks for the PR. As Viktor mentioned it's a breaking change, so we will merge this in for the major version (need to wait it out). |
|
@Nikhil-Manglore Would you be able to add before and after behavior to the top level comment? @valkey-io/core-team This is a breaking change. So, I believe there should be a vote 👍 / 👎 . |
|
@valkey-io/client-maintainers Do you think this will affect any clients? |
Thanks for notifying. Valkey-go will need a small update to make its command builder to take those channel names as routing keys. |
|
I updated the top level description |
|
This change is incomplete. We'd also need to update However I don't think we should make this change without a off-by-default config, even in a major release. Furthermore, I actually don't see a need to change this behavior. We don't need to subject shard-level channels to the global key namespace; rather, shard-level channels can be considered living in their own shard-level namespaces, which don't concern "slots" at all. It is just yet another implementation coincidence that we currently organize shard level channels using a CRC16 hash of their names. More specifically, I think it is fair to consider |
TL;DR: Either no effect or tests breakage valkey-glide: no effect |
@PingXie No, SSUBSCRIBE already has the key specs and would return -CROSSSLOT if attempting to subscribe to shard channels hashing to different slots.
This is not how sharded pubsub works though. Shard channels are hashed to slots just like keys. This is implemented in most of the sharded pubsub commands, including SSUBSCRIBE, SPUBLISH, etc. Only PUBSUB SHARDNUMSUB seems to be missing. |
|
Vote for breaking the change. 👍 is for breaking change and 👎 is for updating the documentation. |
The vote is pretty confusing. Please vote for one @valkey-io/core-team 😜. |
This is a significant breaking change for numerous existing tools that rely on Valkey (or that are currently using Redis and wish to incorporate support for Valkey) because the tools are predicated on specific behaviors. |
|
@avifenesh thanks for sharing your thoughts. This is limited to sharded pubsub which I believe is still maturing and could be improved. Happy to hear client devs feedback though. Could you also share how GLIDE deals with the above issue currently? |
#1369 (comment) for glide, it won't affect the behavior as @ikolomi mentioned. For a detailed answer, he can add more information. |
|
Every two months or so, I go over all PRs marked with major-decision-pending and read up on the details that have been forgotten since last time, which takes time, only to realize that we're never going to approve, nor reject, this one (among others). Apparently, fixing this is a breaking change and it's better to leave it broken. I'm going to close this one now. If anyone thinks it's worth discussing again, it's possible to reopen it. |
Resolved #560
Added key specification to the pubsub-shardnumsub.json file to force the CROSSSLOT error when a user subscribes to two channels in different hash slots.
Prior to this change, running the
PUBSUB SHARDNUMSUBcommand in cluster mode with multiple channels mapping to different slots (e.g., PUBSUB SHARDNUMSUB ch1 ch2) would succeed. It would also return 0 for the channel/slots it's not serving.With this PR, the command will now return a
CROSSSLOTerror if the provided channels map to different hash slots.