BITOP: propagate only when it really SET or DEL targetkey (#5783)

For example:
    BITOP not targetkey sourcekey

If targetkey and sourcekey doesn't exist, BITOP has no effect,
we do not propagate it, thus can save aof and replica flow.

(cherry picked from commit 2cf11ce5ca6804df9ff65bc90dbd1dfc5e2e497c)
This commit is contained in:
zhaozhao.zz 2020-07-10 13:20:27 +08:00 committed by Oran Agra
parent ae2bcd49db
commit a17f059d21

View File

@ -759,11 +759,12 @@ void bitopCommand(client *c) {
setKey(c,c->db,targetkey,o); setKey(c,c->db,targetkey,o);
notifyKeyspaceEvent(NOTIFY_STRING,"set",targetkey,c->db->id); notifyKeyspaceEvent(NOTIFY_STRING,"set",targetkey,c->db->id);
decrRefCount(o); decrRefCount(o);
server.dirty++;
} else if (dbDelete(c->db,targetkey)) { } else if (dbDelete(c->db,targetkey)) {
signalModifiedKey(c,c->db,targetkey); signalModifiedKey(c,c->db,targetkey);
notifyKeyspaceEvent(NOTIFY_GENERIC,"del",targetkey,c->db->id); notifyKeyspaceEvent(NOTIFY_GENERIC,"del",targetkey,c->db->id);
server.dirty++;
} }
server.dirty++;
addReplyLongLong(c,maxlen); /* Return the output string length in bytes. */ addReplyLongLong(c,maxlen); /* Return the output string length in bytes. */
} }