From fc9b4e79589c049276ff4c7cf536b49d700f8cee Mon Sep 17 00:00:00 2001 From: "zhaozhao.zz" Date: Fri, 28 Sep 2018 12:06:43 +0800 Subject: [PATCH] bugfix: replace lastcmd with cmd when rewrite BRPOPLPUSH as RPOPLPUSH There are two problems if we use lastcmd: 1. BRPOPLPUSH cannot be rewrited as RPOPLPUSH in multi/exec In mulit/exec context, the lastcmd is exec. 2. Redis will crash when execute RPOPLPUSH loading from AOF In fakeClient, the lastcmd is NULL. --- src/t_list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t_list.c b/src/t_list.c index 987392e6..c8f4703d 100644 --- a/src/t_list.c +++ b/src/t_list.c @@ -596,7 +596,7 @@ void rpoplpushCommand(client *c) { signalModifiedKey(c->db,touchedkey); decrRefCount(touchedkey); server.dirty++; - if (c->lastcmd->proc == brpoplpushCommand) { + if (c->cmd->proc == brpoplpushCommand) { rewriteClientCommandVector(c,3,shared.rpoplpush,c->argv[1],c->argv[2]); } }