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

Pub/Sub doesn't take namespace into account #952

Open
1 of 2 tasks
torwig opened this issue Oct 4, 2022 · 7 comments
Open
1 of 2 tasks

Pub/Sub doesn't take namespace into account #952

torwig opened this issue Oct 4, 2022 · 7 comments
Labels
bug type bug

Comments

@torwig
Copy link
Contributor

torwig commented Oct 4, 2022

Search before asking

  • I had searched in the issues and found no similar issues.

Version

Latest from the unstable branch, Fedora 35.

Minimal reproduce step

Run kvrocks with additional two namespaces, e.g.

namespace.one password4one
namespace.two password4two

Run two redisc-cli instances, and connect to kvrocks.
Switch to the first namespace via the first redis-cli: auth password4one.
Switch to the second namespace via the second redis-cli: auth password4two.
Execute subscribe channel via the second redisc-cli.
Execute publish channel not-for-second-ns via the first redis-cli.

What did you expect to see?

The message, published in namespace.one should not be received by the subscribers in namespace.two, even if the channel names are the same.

What did you see instead?

Subscribers from namespace.two received the message, published in namespace.one.
For Pub/Sub namespaces aren't isolated.

Anything Else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@torwig torwig added the bug type bug label Oct 4, 2022
@tanruixiang
Copy link
Member

tanruixiang commented Oct 6, 2022

Good Catch. It seems that the reason for the problem is that the namespace information in Connection is not used.

@git-hulk
Copy link
Member

git-hulk commented Oct 7, 2022

I'm also wondering if any users need this feature

@manchurio
Copy link
Contributor

I think this is ok, so does redis.

@git-hulk
Copy link
Member

git-hulk commented Oct 9, 2022

I think this is ok, so does redis.

Yes, this behavior is matched the Redis if we regard the namespace as the Redis DB. So I'm wondering if any users need this feature.

@tanruixiang
Copy link
Member

Yes, this behavior is matched the Redis if we regard the namespace as the Redis DB. So I'm wondering if any users need this feature.

If someone needs this feature, I think they can just use stream.

@git-hulk
Copy link
Member

git-hulk commented Oct 9, 2022

Yes, this behavior is matched the Redis if we regard the namespace as the Redis DB. So I'm wondering if any users need this feature.

If someone needs this feature, I think they can just use stream.

There's a bit different between stream and pubsub. For the stream, it likes most message queue system, all message can be saw before the retention ttl but the pubsub is fire and forget.

@tanruixiang
Copy link
Member

tanruixiang commented Oct 9, 2022

There's a bit different between stream and pubsub. For the stream, it likes most message queue system, all message can be saw before the retention ttl but the pubsub is fire and forget.

Yes, I mean that if someone needs this feature, they can use stream instead in the current situation. In fact, many people who directly use Redis also use stream instead of pubsub to avoid the disadvantages of pubsub. I think it is enough for kvrocks to align with Redis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug type bug
Projects
None yet
Development

No branches or pull requests

4 participants