-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Fix redis-cli with sentinel crash due to SENTINEL DEBUG missing summary #10250
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
Fix redis-cli with sentinel crash due to SENTINEL DEBUG missing summary #10250
Conversation
Because SENTINEL DEBUG missing summary in its json file, with the change in redis#10043, the following assertion will fail. ``` [redis]# src/redis-cli -p 26379 redis-cli: redis-cli.c:678: cliInitCommandHelpEntry: Assertion `reply->type == 1' failed. ``` This commit add the summary and complexity for SENTINEL DEBUG, which introduced in redis#9291, and also improved the help message.
|
the current SENTINEL DEBUG output: and we can update it with SENTINEL DEBUG key value: i guess we need to improve the help message and metion these both |
oranagra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
|
It now occurs to me that all fields of RM_SetCommandInfo are optional. |
|
look like yes. |
|
please load some old module, make sure this is the only change that's needed, and push a PR. |
|
I would have expected a missing field not to be returned by |
|
I suppose you're right. looking at however, i also see it was documented (that these 3 fields are always present). p.s. the module API (RM_SetCommandInfo) doesn't force these to be set (so even on new modules they could be NULL), which will cause COMMAND docs to reply with nil. |
|
for module commands, the regarding modules that don't use RM_SetCommandInfo - i guess we can either reply with NULL or "NA". i think i prefer "NA" regarding modules that use RM_SetCommandInfo - i think we want to enforce that both "summary" and "since" were provided |
|
considering that RM_SetCommandInfo is optional, and considering all of these are metadata that we're not sure have values in some contexts, i don't think we should make any field mandatory. so the question IMHO is if COMMAND docs should reply with Nil when this is missing, or avoid adding that entry to the map. |
|
let's avoid adding it to the map, update the docs, and make sure no one relies on the existence of these keys |
That seems to be the case, yes.
So, we need another PR regarding the output of COMMAND DOCS? |
|
let's avoid adding it to the map. so just need to handle i am testing it. |
|
yep |
If summary or since is empty, we used to return NULL in COMMAND DOCS. Currently all redis commands will have these two fields. But not for module command, summary and since are optional for RM_SetCommandInfo. With the change in redis#10043, if a module command doesn't have the summary or since, redis-cli will crash (see redis#10250). In this commit, COMMAND DOCS avoid adding summary or since when they are missing.
|
Regarding the documentation, it says the "keys are always present in the reply". I would have assumed that means they have string values associated with them. If the key is guaranteed to be present, I'm not sure that associating it with a null value is compliant. |
If summary or since is empty, we used to return NULL in COMMAND DOCS. Currently all redis commands will have these two fields. But not for module command, summary and since are optional for RM_SetCommandInfo. With the change in #10043, if a module command doesn't have the summary or since, redis-cli will crash (see #10250). In this commit, COMMAND DOCS avoid adding summary or since when they are missing.
@jhelbaum I think we need to update the docs too then. It is done with a PR to https://github.com/redis/redis-doc/blob/master/commands/command-docs.md [Edit] It was done already: redis/redis-doc#1780 [Edit again] ... but I see it didn't change the line before the list of fields "The following keys are always present in the reply:", so I guess we can have another PR. :-) |
Because SENTINEL DEBUG missing summary in its json file,
with the change in #10043, the following assertion will fail.
This commit add the summary and complexity for SENTINEL DEBUG,
which introduced in #9291, and also improved the help message.