Comments (6)
@hpatro that would be even better. We can't just rely on UNSUBSCRIBE returning zero in the last field, because there may still be shard-channel subscriptions.
@hwware created a PR to print a message but it doesn't seem to be linked. I think we can do both.
from valkey.
from valkey.
valkey-cli thinks that it is in "subscribed mode" even after unsubscribing to all channels. It is not the same as the pubsub client flag on the server. Valkey-cli is not aware of the client flag. In valkey-cli, you need to press Ctrl+C to exit subscribed mode and when you do that, valkey-cli reconnects.
If we start changing the behaviour depending on the cliet flag on the server side, this is unexpected to clients, because they are usually not aware of the client flags.
Why do you want it to return an error? Isn't it better that UNSUBSCRIBE behaves in the same way always?
I think the real problem is actually that SUBSCRIBE and UNSUBSCRIBE can return more than one reply. This is confusing for clients, even valkey-cli before it was fixed. Client's can't just pass a command to the server without checking which command they are sending. They need to treat [P|S][UN]SUBSCRIBE
specially.
from valkey.
I think this is the same issue which I had raised earlier in redis redis/redis#12592. @zuiderkwast and I discussed a solution over there. I think it's easy to maintain the subscription information and take action on it in the cli code.
from valkey.
I think the point is: the client only send ONE request with multiple channels to server, while the server reply MULTIPLE replies.
from valkey.
@kamyuentse Yes, but this is what SUBSCRIBE ch1 ch2
does too. It returns one response per channel. But that's only in subscribed mode?
In topics/protocol.md we can read this:
When a RESP2 connection subscribes to a Pub/Sub channel, the protocol changes semantics and becomes a push protocol. The client no longer requires sending commands because the server will automatically send new messages to the client (for the channels the client is subscribed to) as soon as they are received.
... and in topics/pubsub.md:
In
subscribe
,unsubscribe
,psubscribe
andpunsubscribe
message types, the last argument is the count of subscriptions still active. This number is the total number of channels and patterns the client is still subscribed to. So the client will exit the Pub/Sub state only when this count drops to zero as a result of unsubscribing from all the channels and patterns.
(The above needs to be edited to include sharded-pubsub channels too.)
I think this is what we can consider a bug: If the client is not subscribed to any channel, it should be a request-response protocol with one response for every request.
from valkey.
Related Issues (20)
- [Daily Test Failure] 12-master-reboot.tcl in test-sanitizer-address (clang)
- [Daily Test Failure] tests/unit/cluster/slot-migration.tcl in test-macos-latest
- Improve type safety of key embedding
- code usege of sds (and maybe other data types) HOT 1
- Add maxmemory-reserved-scale parameter to evict keys earlier HOT 2
- [NEW] WAIT ALL HOT 4
- [BUG] Example ACL for sentinel does not work HOT 1
- []Defrag level is calculated correctly HOT 1
- [NEW] Cluster support without special client bindings HOT 2
- [NEW] Opt-in for inclusive language (primary/replia in ROLE reply, CLUSTER SHARDS, etc.) HOT 4
- Regression from PR #445 Incorrectly Allows Slot Ownership Updates via Replica HOT 1
- Followup items from https://github.com/valkey-io/valkey/pull/758
- [NEW] Better branching strategy for Valkey HOT 10
- [Test Case Fail]External Server Tests HOT 3
- [BUG] nodes.conf can be corrupted when node is restarted before cluster shard ID stabilizes (for 7.2) HOT 8
- [BUG] CLUSTER SHARDS command returns "empty array" in slots section HOT 6
- [NEW] Can we add 'count' option to the 'RANDOMKEY' command? HOT 5
- [NEW] Nightly builds for Docker HOT 2
- Update rioconnwrite size from https://github.com/valkey-io/valkey/pull/60 HOT 5
- Missing Check for Sender's Config Epoch Before Accepting Primary Claim
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from valkey.