From b95beeb595c94649cfda4b2bd8049cf5ddb07868 Mon Sep 17 00:00:00 2001 From: Binbin Date: Mon, 7 Feb 2022 19:27:33 +0800 Subject: [PATCH] Fix redis-cli with sentinel crash due to SENTINEL DEBUG missing summary (#10250) Fix redis-cli with sentinel crash due to SENTINEL DEBUG missing summary Because SENTINEL DEBUG missing summary in its json file, with the change in #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 #9291, and also improved the help message. --- src/commands.c | 2 +- src/commands/sentinel-debug.json | 2 ++ src/sentinel.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/commands.c b/src/commands.c index 0b164cf385..3a9df2f843 100644 --- a/src/commands.c +++ b/src/commands.c @@ -3759,7 +3759,7 @@ struct redisCommand SCRIPT_Subcommands[] = { struct redisCommand SENTINEL_Subcommands[] = { {"ckquorum","Check for a Sentinel quorum",NULL,"2.8.4",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_SENTINEL,SENTINEL_CKQUORUM_History,SENTINEL_CKQUORUM_tips,sentinelCommand,3,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0}, {"config","Configure Sentinel","O(1)","6.2.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_SENTINEL,SENTINEL_CONFIG_History,SENTINEL_CONFIG_tips,sentinelCommand,-3,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0}, -{"debug",NULL,NULL,"7.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_SENTINEL,SENTINEL_DEBUG_History,SENTINEL_DEBUG_tips,sentinelCommand,-2,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0}, +{"debug","List or update the current configurable parameters","O(N) where N is the number of configurable parameters","7.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_SENTINEL,SENTINEL_DEBUG_History,SENTINEL_DEBUG_tips,sentinelCommand,-2,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0}, {"failover","Force a failover",NULL,"2.8.4",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_SENTINEL,SENTINEL_FAILOVER_History,SENTINEL_FAILOVER_tips,sentinelCommand,3,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0}, {"flushconfig","Rewrite configuration file","O(1)","2.8.4",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_SENTINEL,SENTINEL_FLUSHCONFIG_History,SENTINEL_FLUSHCONFIG_tips,sentinelCommand,2,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0}, {"get-master-addr-by-name","Get port and address of a master","O(1)","2.8.4",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_SENTINEL,SENTINEL_GET_MASTER_ADDR_BY_NAME_History,SENTINEL_GET_MASTER_ADDR_BY_NAME_tips,sentinelCommand,3,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0}, diff --git a/src/commands/sentinel-debug.json b/src/commands/sentinel-debug.json index ed771c4f72..44c6bec9b5 100644 --- a/src/commands/sentinel-debug.json +++ b/src/commands/sentinel-debug.json @@ -1,5 +1,7 @@ { "DEBUG": { + "summary": "List or update the current configurable parameters", + "complexity": "O(N) where N is the number of configurable parameters", "group": "sentinel", "since": "7.0.0", "arity": -2, diff --git a/src/sentinel.c b/src/sentinel.c index 937a5b86f1..98121acdeb 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -3735,8 +3735,9 @@ void sentinelCommand(client *c) { " Set a global Sentinel configuration parameter.", "CONFIG GET ", " Get global Sentinel configuration parameter.", -"DEBUG", +"DEBUG [ ...]", " Show a list of configurable time parameters and their values (milliseconds).", +" Or update current configurable parameters values (one or more).", "GET-MASTER-ADDR-BY-NAME ", " Return the ip and port number of the master with that name.", "FAILOVER ",