diff options
author | antirez <antirez@gmail.com> | 2013-03-06 16:28:26 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2013-03-06 16:28:26 +0100 |
commit | 7b190a08cfe9aded4c64b775fa2a2ab24b7b9405 (patch) | |
tree | 4a1ad53fab290c3acd7f8780f6d921b459da28d3 /src/networking.c | |
parent | 4d62912619d10667bf06d683290fd0d33c1fcf6c (diff) | |
download | redis-7b190a08cfe9aded4c64b775fa2a2ab24b7b9405.tar.gz |
API to lookup commands with their original name.
A new server.orig_commands table was added to the server structure, this
contains a copy of the commant table unaffected by rename-command
statements in redis.conf.
A new API lookupCommandOrOriginal() was added that checks both tables,
new first, old later, so that rewriteClientCommandVector() and friends
can lookup commands with their new or original name in order to fix the
client->cmd pointer when the argument vector is renamed.
This fixes the segfault of issue #986, but does not fix a wider range of
problems resulting from renaming commands that actually operate on data
and are registered into the AOF file or propagated to slaves... That is
command renaming should be handled with care.
Diffstat (limited to 'src/networking.c')
-rw-r--r-- | src/networking.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/networking.c b/src/networking.c index 2c4050723..1fd803b65 100644 --- a/src/networking.c +++ b/src/networking.c @@ -1295,7 +1295,7 @@ void rewriteClientCommandVector(redisClient *c, int argc, ...) { /* Replace argv and argc with our new versions. */ c->argv = argv; c->argc = argc; - c->cmd = lookupCommand(c->argv[0]->ptr); + c->cmd = lookupCommandOrOriginal(c->argv[0]->ptr); redisAssertWithInfo(c,NULL,c->cmd != NULL); va_end(ap); } @@ -1313,7 +1313,7 @@ void rewriteClientCommandArgument(redisClient *c, int i, robj *newval) { /* If this is the command name make sure to fix c->cmd. */ if (i == 0) { - c->cmd = lookupCommand(c->argv[0]->ptr); + c->cmd = lookupCommandOrOriginal(c->argv[0]->ptr); redisAssertWithInfo(c,NULL,c->cmd != NULL); } } |