]> git.saurik.com Git - redis.git/blobdiff - src/multi.c
Merge branch 'unstable'
[redis.git] / src / multi.c
index 47615eb04ff18c7872964600365580d6dec59ea1..ba3a0cd6caaa0cf96e7fdb883ee0f1ad902efdbb 100644 (file)
@@ -65,12 +65,10 @@ void discardCommand(redisClient *c) {
 /* Send a MULTI command to all the slaves and AOF file. Check the execCommand
  * implememntation for more information. */
 void execCommandReplicateMulti(redisClient *c) {
 /* Send a MULTI command to all the slaves and AOF file. Check the execCommand
  * implememntation for more information. */
 void execCommandReplicateMulti(redisClient *c) {
-    struct redisCommand *cmd;
     robj *multistring = createStringObject("MULTI",5);
 
     robj *multistring = createStringObject("MULTI",5);
 
-    cmd = lookupCommand("multi");
     if (server.appendonly)
     if (server.appendonly)
-        feedAppendOnlyFile(cmd,c->db->id,&multistring,1);
+        feedAppendOnlyFile(server.multiCommand,c->db->id,&multistring,1);
     if (listLength(server.slaves))
         replicationFeedSlaves(server.slaves,c->db->id,&multistring,1);
     decrRefCount(multistring);
     if (listLength(server.slaves))
         replicationFeedSlaves(server.slaves,c->db->id,&multistring,1);
     decrRefCount(multistring);
@@ -112,6 +110,10 @@ void execCommand(redisClient *c) {
         c->argc = c->mstate.commands[j].argc;
         c->argv = c->mstate.commands[j].argv;
         call(c,c->mstate.commands[j].cmd);
         c->argc = c->mstate.commands[j].argc;
         c->argv = c->mstate.commands[j].argv;
         call(c,c->mstate.commands[j].cmd);
+
+        /* Commands may alter argc/argv, restore mstate. */
+        c->mstate.commands[j].argc = c->argc;
+        c->mstate.commands[j].argv = c->argv;
     }
     c->argv = orig_argv;
     c->argc = orig_argc;
     }
     c->argv = orig_argv;
     c->argc = orig_argc;