Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
91a384a5
Commit
91a384a5
authored
Jun 25, 2018
by
antirez
Browse files
Sentinel command renaming: implement SENTINEL SET.
parent
903582dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/sentinel.c
View file @
91a384a5
...
@@ -3467,6 +3467,25 @@ void sentinelSetCommand(client *c) {
...
@@ -3467,6 +3467,25 @@ void sentinelSetCommand(client *c) {
goto badfmt;
goto badfmt;
ri->quorum = ll;
ri->quorum = ll;
changes++;
changes++;
} else if (!strcasecmp(option,"rename-command") && moreargs > 1) {
/* rename-command <oldname> <newname>
*
* Note: if newname is the empty string the command renaming
* entry is deleted. */
sds oldname = c->argv[++j]->ptr;
sds newname = c->argv[++j]->ptr;
/* Remove any older renaming for this command. */
dictDelete(ri->renamed_commands,oldname);
/* If the target name length is not zero, we need to add the
* actual entry to the renamed table. */
if (sdslen(newname)) {
oldname = sdsdup(oldname);
newname = sdsdup(newname);
dictAdd(ri->renamed_commands,oldname,newname);
}
changes++;
} else {
} else {
addReplyErrorFormat(c,"Unknown option or number of arguments for "
addReplyErrorFormat(c,"Unknown option or number of arguments for "
"SENTINEL SET '%s'", option);
"SENTINEL SET '%s'", option);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment