Commit 6b7ad838 authored by zhaozhao.zz's avatar zhaozhao.zz Committed by antirez
Browse files

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.
parent 3454a043
...@@ -596,7 +596,7 @@ void rpoplpushCommand(client *c) { ...@@ -596,7 +596,7 @@ void rpoplpushCommand(client *c) {
signalModifiedKey(c->db,touchedkey); signalModifiedKey(c->db,touchedkey);
decrRefCount(touchedkey); decrRefCount(touchedkey);
server.dirty++; server.dirty++;
if (c->lastcmd->proc == brpoplpushCommand) { if (c->cmd->proc == brpoplpushCommand) {
rewriteClientCommandVector(c,3,shared.rpoplpush,c->argv[1],c->argv[2]); rewriteClientCommandVector(c,3,shared.rpoplpush,c->argv[1],c->argv[2]);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment