Add sharded pubsub keychannel count to client info (#10895)
When calling CLIENT INFO/LIST, and in various debug prints, Redis is printing the number of pubsub channels / patterns the client is subscribed to. With the addition of sharded pubsub, it would be useful to print the number of keychannels the client is subscribed to as well.
This commit is contained in:
parent
069b30a2b3
commit
35c2ee8716
|
@ -2785,7 +2785,7 @@ sds catClientInfoString(sds s, client *client) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sds ret = sdscatfmt(s,
|
sds ret = sdscatfmt(s,
|
||||||
"id=%U addr=%s laddr=%s %s name=%s age=%I idle=%I flags=%s db=%i sub=%i psub=%i multi=%i qbuf=%U qbuf-free=%U argv-mem=%U multi-mem=%U rbs=%U rbp=%U obl=%U oll=%U omem=%U tot-mem=%U events=%s cmd=%s user=%s redir=%I resp=%i",
|
"id=%U addr=%s laddr=%s %s name=%s age=%I idle=%I flags=%s db=%i sub=%i psub=%i ssub=%i multi=%i qbuf=%U qbuf-free=%U argv-mem=%U multi-mem=%U rbs=%U rbp=%U obl=%U oll=%U omem=%U tot-mem=%U events=%s cmd=%s user=%s redir=%I resp=%i",
|
||||||
(unsigned long long) client->id,
|
(unsigned long long) client->id,
|
||||||
getClientPeerId(client),
|
getClientPeerId(client),
|
||||||
getClientSockname(client),
|
getClientSockname(client),
|
||||||
|
@ -2797,6 +2797,7 @@ sds catClientInfoString(sds s, client *client) {
|
||||||
client->db->id,
|
client->db->id,
|
||||||
(int) dictSize(client->pubsub_channels),
|
(int) dictSize(client->pubsub_channels),
|
||||||
(int) listLength(client->pubsub_patterns),
|
(int) listLength(client->pubsub_patterns),
|
||||||
|
(int) dictSize(client->pubsubshard_channels),
|
||||||
(client->flags & CLIENT_MULTI) ? client->mstate.count : -1,
|
(client->flags & CLIENT_MULTI) ? client->mstate.count : -1,
|
||||||
(unsigned long long) sdslen(client->querybuf),
|
(unsigned long long) sdslen(client->querybuf),
|
||||||
(unsigned long long) sdsavail(client->querybuf),
|
(unsigned long long) sdsavail(client->querybuf),
|
||||||
|
|
|
@ -7,7 +7,7 @@ start_server {tags {"introspection"}} {
|
||||||
|
|
||||||
test {CLIENT LIST} {
|
test {CLIENT LIST} {
|
||||||
r client list
|
r client list
|
||||||
} {id=* addr=*:* laddr=*:* fd=* name=* age=* idle=* flags=N db=* sub=0 psub=0 multi=-1 qbuf=26 qbuf-free=* argv-mem=* multi-mem=0 rbs=* rbp=* obl=0 oll=0 omem=0 tot-mem=* events=r cmd=client|list user=* redir=-1 resp=2*}
|
} {id=* addr=*:* laddr=*:* fd=* name=* age=* idle=* flags=N db=* sub=0 psub=0 ssub=0 multi=-1 qbuf=26 qbuf-free=* argv-mem=* multi-mem=0 rbs=* rbp=* obl=0 oll=0 omem=0 tot-mem=* events=r cmd=client|list user=* redir=-1 resp=2*}
|
||||||
|
|
||||||
test {CLIENT LIST with IDs} {
|
test {CLIENT LIST with IDs} {
|
||||||
set myid [r client id]
|
set myid [r client id]
|
||||||
|
@ -17,7 +17,7 @@ start_server {tags {"introspection"}} {
|
||||||
|
|
||||||
test {CLIENT INFO} {
|
test {CLIENT INFO} {
|
||||||
r client info
|
r client info
|
||||||
} {id=* addr=*:* laddr=*:* fd=* name=* age=* idle=* flags=N db=* sub=0 psub=0 multi=-1 qbuf=26 qbuf-free=* argv-mem=* multi-mem=0 rbs=* rbp=* obl=0 oll=0 omem=0 tot-mem=* events=r cmd=client|info user=* redir=-1 resp=2*}
|
} {id=* addr=*:* laddr=*:* fd=* name=* age=* idle=* flags=N db=* sub=0 psub=0 ssub=0 multi=-1 qbuf=26 qbuf-free=* argv-mem=* multi-mem=0 rbs=* rbp=* obl=0 oll=0 omem=0 tot-mem=* events=r cmd=client|info user=* redir=-1 resp=2*}
|
||||||
|
|
||||||
test {CLIENT KILL with illegal arguments} {
|
test {CLIENT KILL with illegal arguments} {
|
||||||
assert_error "ERR wrong number of arguments for 'client|kill' command" {r client kill}
|
assert_error "ERR wrong number of arguments for 'client|kill' command" {r client kill}
|
||||||
|
|
Loading…
Reference in New Issue