From 3a0b78bc52e30a8599203ef501ea548b96f08b89 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 12 Sep 2017 10:48:27 +0200 Subject: [PATCH] Streams: rewrite XADD ID argument for AOF/slaves. --- src/t_stream.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/t_stream.c b/src/t_stream.c index 0921a54b..84e0541e 100644 --- a/src/t_stream.c +++ b/src/t_stream.c @@ -414,6 +414,16 @@ void xaddCommand(client *c) { signalModifiedKey(c->db,c->argv[1]); notifyKeyspaceEvent(NOTIFY_STREAM,"xadd",c->argv[1],c->db->id); server.dirty++; + + /* Let's rewrite the ID argument with the one actually generated for + * AOF/replication propagation. */ + robj *idarg = createObject(OBJ_STRING, + sdscatfmt(sdsempty(),"%U.%U",id.ms,id.seq)); + rewriteClientCommandArgument(c,i,idarg); + decrRefCount(idarg); + + /* We need to signal to blocked clients that there is new data on this + * stream. */ if (server.blocked_clients_by_type[BLOCKED_STREAM]) signalKeyAsReady(c->db, c->argv[1]); }