summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBinbin <binloveplay1314@qq.com>2021-12-08 14:59:02 +0800
committerGitHub <noreply@github.com>2021-12-08 08:59:02 +0200
commita7726cdf517eca16dec37655881ddae2688aaaeb (patch)
tree5dc38f82ca29c9f111dd71b6aa8a643d82f3ae35
parent08ed44d722a278b9d0aa6a08c760ee1fc5a0f6ed (diff)
downloadredis-a7726cdf517eca16dec37655881ddae2688aaaeb.tar.gz
Fix SENTINEL subcommands's arity (#9909)
For `SENTINEL SET`, we can use in these ways: 1. SENTINEL SET mymaster quorum 3 2. SENTINEL SET mymaster quorum 5 parallel-syncs 1 For `SENTINEL SIMULATE-FAILURE`, although it is only used for testing: 1. SENTINEL SIMULATE-FAILURE CRASH-AFTER-ELECTION 2. SENTINEL SIMULATE-FAILURE CRASH-AFTER-ELECTION CRASH-AFTER-PROMOTION
-rw-r--r--src/sentinel.c5
-rw-r--r--src/server.c4
2 files changed, 4 insertions, 5 deletions
diff --git a/src/sentinel.c b/src/sentinel.c
index 297f0591f..e30981039 100644
--- a/src/sentinel.c
+++ b/src/sentinel.c
@@ -3726,9 +3726,9 @@ void sentinelCommand(client *c) {
" Reset masters for specific master name matching this pattern.",
"SENTINELS <master-name>",
" Show a list of Sentinel instances for this master and their state.",
-"SET <master-name> <option> <value>",
+"SET <master-name> <option> <value> [<option> <value> ...]",
" Set configuration parameters for certain masters.",
-"SIMULATE-FAILURE (CRASH-AFTER-ELECTION|CRASH-AFTER-PROMOTION|HELP)",
+"SIMULATE-FAILURE [CRASH-AFTER-ELECTION] [CRASH-AFTER-PROMOTION] [HELP]",
" Simulate a Sentinel crash.",
NULL
};
@@ -3943,7 +3943,6 @@ NULL
addReplyErrorSds(c,e);
}
} else if (!strcasecmp(c->argv[1]->ptr,"set")) {
- if (c->argc <= 3) goto numargserr;
sentinelSetCommand(c);
} else if (!strcasecmp(c->argv[1]->ptr,"config")) {
if (c->argc < 3) goto numargserr;
diff --git a/src/server.c b/src/server.c
index 545222d5a..1e9ef8a4b 100644
--- a/src/server.c
+++ b/src/server.c
@@ -693,10 +693,10 @@ struct redisCommand sentinelSubcommands[] = {
{"sentinels",sentinelCommand,3,
"admin only-sentinel"},
- {"set",sentinelCommand,-3,
+ {"set",sentinelCommand,-5,
"admin only-sentinel"},
- {"simulate-failure",sentinelCommand,3,
+ {"simulate-failure",sentinelCommand,-3,
"admin only-sentinel"},
{"help",sentinelCommand,2,