Skip to content

Add CLIENT INFO subcommand.#8113

Merged
yossigo merged 4 commits intoredis:unstablefrom
yossigo:client-info-command
Dec 7, 2020
Merged

Add CLIENT INFO subcommand.#8113
yossigo merged 4 commits intoredis:unstablefrom
yossigo:client-info-command

Conversation

@yossigo
Copy link
Collaborator

@yossigo yossigo commented Nov 30, 2020

The output is identical to CLIENT LIST but provides a single line for
the current client only.

The output is identical to CLIENT LIST but provides a single line for
the current client only.
@yossigo yossigo added state-doc-needed state:major-decision Requires core team consensus release-notes indication that this issue needs to be mentioned in the release notes labels Nov 30, 2020
Copy link
Member

@oranagra oranagra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was some discussion about adding a command like CLIENT INFO [id].
but considering ACL, maybe we don't wanna mix it with the current one.
maybe another one needs to be added for that purpose, or maybe CLIENT LIST, needs to be added with an ID <id> argument.
WDYT?

@yossigo
Copy link
Collaborator Author

yossigo commented Nov 30, 2020

I think CLIENT LIST ID <id> makes sense as an admin privileged command.

@oranagra
Copy link
Member

oranagra commented Dec 1, 2020

@redis/core-team please approve

Copy link
Contributor

@madolson madolson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments.

if (cl) {
o = catClientInfoString(o, cl);
o = sdscatlen(o, "\n", 1);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also throw the invalid client ID on the else here instead of silently failing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considered that, but that would mean failing the entire operation and returning an error instead of a verbatim text. To me that would make sense if we only handle a single ID at a time, but I don't feel too strongly about that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was on the fence about this, I would be inclined to throw an error, but am fine either way. I would like to have some indication that an ID was requested but nothing was found, like a NULL response, but we can't do that here since it's trying to stay compatible with CLIENT list. It also seems annoying to have the request fail because a client was disconnected for some reason.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unlike HMGET etc, where the index of the request has to match the index of the response. this one is a verbatim string, and each line has the ID which the user can match to the ones he requested.
it's not ideal, but considering the alternatives i think that's the right thing to do (current code).

itamarhaber
itamarhaber previously approved these changes Dec 2, 2020
@itamarhaber itamarhaber added state:needs-doc-pr requires a PR to redis-doc repository and removed state-doc-needed labels Dec 2, 2020
oranagra
oranagra previously approved these changes Dec 4, 2020
itamarhaber
itamarhaber previously approved these changes Dec 5, 2020
soloestoy
soloestoy previously approved these changes Dec 7, 2020
@oranagra
Copy link
Member

oranagra commented Dec 7, 2020

@yossigo i think you can apply Itamar's suggestion and merge this.

Co-authored-by: Itamar Haber <[email protected]>
@yossigo yossigo dismissed stale reviews from soloestoy, itamarhaber, and oranagra via 86e8a82 December 7, 2020 11:59
@yossigo yossigo merged commit bccbc55 into redis:unstable Dec 7, 2020
@yossigo yossigo deleted the client-info-command branch December 7, 2020 12:24
@oranagra oranagra mentioned this pull request Jan 13, 2021
JackieXie168 pushed a commit to JackieXie168/redis that referenced this pull request Mar 2, 2021
* Add CLIENT INFO subcommand.

The output is identical to CLIENT LIST but provides a single line for
the current client only.

* Add CLIENT LIST ID [id...].

Co-authored-by: Itamar Haber <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes indication that this issue needs to be mentioned in the release notes state:major-decision Requires core team consensus state:needs-doc-pr requires a PR to redis-doc repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants