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

[BUG] PUBSUB SHARDNUMSUB doesn't return -CROSSSLOT for cross slot shard-channels #560

Open
zuiderkwast opened this issue May 27, 2024 · 5 comments · May be fixed by #1369
Open

[BUG] PUBSUB SHARDNUMSUB doesn't return -CROSSSLOT for cross slot shard-channels #560

zuiderkwast opened this issue May 27, 2024 · 5 comments · May be fixed by #1369
Assignees
Labels
breaking-change Indicates a possible backwards incompatible change help wanted External contributions would be appreciated

Comments

@zuiderkwast
Copy link
Contributor

Describe the bug

In cluster mode, calling this command with two channels mapping to different slots, like PUBSUB SHARDNUMSUB ch1 ch2, succeeds. It should return a -CROSSSLOT error, like any command with keys of two different slots.

To reproduce

Call the command with two channels mapping to the same node, but different cluster slots.

Expected behavior

-CROSSSLOT error reply.

Additional information

I believe it's enough to add a key specification in the command's JSON file under src/commands/. That would make the generic machinery for cluster crosslot detect the error early and return an error.

@zuiderkwast zuiderkwast added the help wanted External contributions would be appreciated label May 27, 2024
@PingXie
Copy link
Member

PingXie commented May 28, 2024

First of all this would be a breaking change. Second, I think it is too late to make this change. This behavior is now part of the command's contract.

@hpatro @madolson thoughts?

@zuiderkwast zuiderkwast added the breaking-change Indicates a possible backwards incompatible change label May 28, 2024
@madolson
Copy link
Member

madolson commented May 28, 2024

We discussed this in Redis and we were planning on breaking it for Redis 8.

redis/redis#12228

My comment at the time was that I viewed this more as a bug because cluster routing wouldn't work for some clients. If you sent PUBSUB SHARDNUMBSUB <foo>, some clients, like go, wouldn't know where to send it. My tenet is we should be okay with breaking changes that are actively harming end users, and I think that is the case here.

@hpatro
Copy link
Contributor

hpatro commented May 28, 2024

First of all this would be a breaking change. Second, I think it is too late to make this change. This behavior is now part of the command's contract.

@hpatro @madolson thoughts?

Sharded pubsub isn't that well adopted yet. We still have some room to smooth rough edges until the wrong behavior becomes the defacto. I'm cool with fixing the behavior for multi channel input.

@PingXie
Copy link
Member

PingXie commented May 28, 2024

SGTM - thanks for the context

@zuiderkwast
Copy link
Contributor Author

Sharded pubsub isn't that well adopted yet. We still have some room to smooth rough edges until the wrong behavior becomes the defacto. I'm cool with fixing the behavior for multi channel input.

This is very much my view too.

That's why I'm OK with other things for sharded pubsub, like using replication link, but I don't think it's OK to do such changes for regular pubsub.

@hpatro hpatro self-assigned this Nov 13, 2024
Nikhil-Manglore added a commit to Nikhil-Manglore/valkey that referenced this issue Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Indicates a possible backwards incompatible change help wanted External contributions would be appreciated
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants