From e85d6f22cf2ddb2a4a5de80b211802bdacbf4a3b Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 2 Mar 2016 08:51:27 +0100 Subject: [PATCH] Fix INFO commandstats reporting when argv is rewritten. We want to report the original command in the stats, for example GEOADD, even when what is actually executed is the ZADD implementation. --- src/scripting.c | 2 +- src/server.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/scripting.c b/src/scripting.c index fb1ae9c6..9da48ff3 100644 --- a/src/scripting.c +++ b/src/scripting.c @@ -463,7 +463,7 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) { luaPushError(lua,"Unknown Redis command called from Lua script"); goto cleanup; } - c->cmd = cmd; + c->cmd = c->lastcmd = cmd; /* There are commands that are not allowed inside scripts. */ if (cmd->flags & CMD_NOSCRIPT) { diff --git a/src/server.c b/src/server.c index 1d189986..484716ab 100644 --- a/src/server.c +++ b/src/server.c @@ -2270,8 +2270,8 @@ void call(client *c, int flags) { slowlogPushEntryIfNeeded(c->argv,c->argc,duration); } if (flags & CMD_CALL_STATS) { - c->cmd->microseconds += duration; - c->cmd->calls++; + c->lastcmd->microseconds += duration; + c->lastcmd->calls++; } /* Propagate the command into the AOF and replication link */