diff options
author | antirez <antirez@gmail.com> | 2013-03-26 10:27:45 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2013-03-27 09:06:59 +0100 |
commit | d1369c3d9f43603d39bf23cbfe8dcd031f9b6a2e (patch) | |
tree | cb6daa2d8af22f1ba0885a9ded50836ec5d0014b | |
parent | 68189054067d54bf0c1f697244ff5b6b8842635c (diff) | |
download | redis-d1369c3d9f43603d39bf23cbfe8dcd031f9b6a2e.tar.gz |
Transactions: use the propagate() API to propagate MULTI.
The behavior is the same, but the code is now cleaner and uses the
proper interface instead of dealing directly with AOF/replication
functions.
-rw-r--r-- | src/multi.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/multi.c b/src/multi.c index dfac15c34..2ceca8caf 100644 --- a/src/multi.c +++ b/src/multi.c @@ -103,13 +103,11 @@ void discardCommand(redisClient *c) { /* Send a MULTI command to all the slaves and AOF file. Check the execCommand * implementation for more information. */ -void execCommandReplicateMulti(redisClient *c) { +void execCommandPropagateMulti(redisClient *c) { robj *multistring = createStringObject("MULTI",5); - if (server.aof_state != REDIS_AOF_OFF) - feedAppendOnlyFile(server.multiCommand,c->db->id,&multistring,1); - if (listLength(server.slaves)) - replicationFeedSlaves(server.slaves,c->db->id,&multistring,1); + propagate(server.multiCommand,c->db->id,&multistring,1, + REDIS_PROPAGATE_AOF|REDIS_PROPAGATE_REPL); decrRefCount(multistring); } @@ -140,11 +138,11 @@ void execCommand(redisClient *c) { goto handle_monitor; } - /* Replicate a MULTI request now that we are sure the block is executed. + /* Propagate a MULTI request now that we are sure the block is executed. * This way we'll deliver the MULTI/..../EXEC block as a whole and * both the AOF and the replication link will have the same consistency * and atomicity guarantees. */ - execCommandReplicateMulti(c); + execCommandPropagateMulti(c); /* Exec all the queued commands */ unwatchAllKeys(c); /* Unwatch ASAP otherwise we'll waste CPU cycles */ |