summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-02-11 10:11:28 +0100
committerantirez <antirez@gmail.com>2015-02-11 10:52:28 +0100
commita37d0f8b48e91d1ec50ac97ef7fa832794cf6edd (patch)
tree6013e32c8cb496808d041ffa0f83914a3bc8dd65
parent9feee428f25a5681a06cd13ed1c4cc644759e719 (diff)
downloadredis-a37d0f8b48e91d1ec50ac97ef7fa832794cf6edd.tar.gz
SPOP with count: fix replication for code path #3.
-rw-r--r--src/t_set.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/t_set.c b/src/t_set.c
index 13b642dd4..c8141c3f6 100644
--- a/src/t_set.c
+++ b/src/t_set.c
@@ -517,10 +517,18 @@ void spopWithCountCommand(redisClient *c) {
si = setTypeInitIterator(set);
while((encoding = setTypeNext(si,&objele,&llele)) != -1) {
if (encoding == REDIS_ENCODING_INTSET) {
- addReplyBulkLongLong(c,llele);
+ objele = createStringObjectFromLongLong(llele);
} else {
- addReplyBulk(c,objele);
+ incrRefCount(objele);
}
+ addReplyBulk(c,objele);
+
+ /* Replicate/AOF this command as an SREM operation */
+ propargv[2] = objele;
+ alsoPropagate(server.sremCommand,c->db->id,propargv,3,
+ REDIS_PROPAGATE_AOF|REDIS_PROPAGATE_REPL);
+
+ decrRefCount(objele);
}
setTypeReleaseIterator(si);
decrRefCount(set);