Fix some wrong server.dirty increments (#8140)
Fix wrong server dirty increment in * spopWithCountCommand * hsetCommand * ltrimCommand * pfaddCommand Some didn't increment the amount of fields (just one per command). Others had excessive increments.
This commit is contained in:
parent
9acd40d97b
commit
7993780dda
3
src/db.c
3
src/db.c
@ -616,6 +616,9 @@ void flushAllDataAndResetRDB(int flags) {
|
|||||||
rdbSave(server.rdb_filename,rsiptr);
|
rdbSave(server.rdb_filename,rsiptr);
|
||||||
server.dirty = saved_dirty;
|
server.dirty = saved_dirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Without that extra dirty++, when db was already empty, FLUSHALL will
|
||||||
|
* not be replicated nor put into the AOF. */
|
||||||
server.dirty++;
|
server.dirty++;
|
||||||
#if defined(USE_JEMALLOC)
|
#if defined(USE_JEMALLOC)
|
||||||
/* jemalloc 5 doesn't release pages back to the OS when there's no traffic.
|
/* jemalloc 5 doesn't release pages back to the OS when there's no traffic.
|
||||||
|
@ -1211,7 +1211,7 @@ void pfaddCommand(client *c) {
|
|||||||
if (updated) {
|
if (updated) {
|
||||||
signalModifiedKey(c,c->db,c->argv[1]);
|
signalModifiedKey(c,c->db,c->argv[1]);
|
||||||
notifyKeyspaceEvent(NOTIFY_STRING,"pfadd",c->argv[1],c->db->id);
|
notifyKeyspaceEvent(NOTIFY_STRING,"pfadd",c->argv[1],c->db->id);
|
||||||
server.dirty++;
|
server.dirty += updated;
|
||||||
HLL_INVALIDATE_CACHE(hdr);
|
HLL_INVALIDATE_CACHE(hdr);
|
||||||
}
|
}
|
||||||
addReply(c, updated ? shared.cone : shared.czero);
|
addReply(c, updated ? shared.cone : shared.czero);
|
||||||
|
@ -644,7 +644,7 @@ void hsetCommand(client *c) {
|
|||||||
}
|
}
|
||||||
signalModifiedKey(c,c->db,c->argv[1]);
|
signalModifiedKey(c,c->db,c->argv[1]);
|
||||||
notifyKeyspaceEvent(NOTIFY_HASH,"hset",c->argv[1],c->db->id);
|
notifyKeyspaceEvent(NOTIFY_HASH,"hset",c->argv[1],c->db->id);
|
||||||
server.dirty++;
|
server.dirty += (c->argc - 2)/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hincrbyCommand(client *c) {
|
void hincrbyCommand(client *c) {
|
||||||
|
@ -508,7 +508,7 @@ void ltrimCommand(client *c) {
|
|||||||
notifyKeyspaceEvent(NOTIFY_GENERIC,"del",c->argv[1],c->db->id);
|
notifyKeyspaceEvent(NOTIFY_GENERIC,"del",c->argv[1],c->db->id);
|
||||||
}
|
}
|
||||||
signalModifiedKey(c,c->db,c->argv[1]);
|
signalModifiedKey(c,c->db,c->argv[1]);
|
||||||
server.dirty++;
|
server.dirty += (ltrim + rtrim);
|
||||||
addReply(c,shared.ok);
|
addReply(c,shared.ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,7 +476,7 @@ void spopWithCountCommand(client *c) {
|
|||||||
|
|
||||||
/* Generate an SPOP keyspace notification */
|
/* Generate an SPOP keyspace notification */
|
||||||
notifyKeyspaceEvent(NOTIFY_SET,"spop",c->argv[1],c->db->id);
|
notifyKeyspaceEvent(NOTIFY_SET,"spop",c->argv[1],c->db->id);
|
||||||
server.dirty += count;
|
server.dirty += (count >= size) ? size : count;
|
||||||
|
|
||||||
/* CASE 1:
|
/* CASE 1:
|
||||||
* The number of requested elements is greater than or equal to
|
* The number of requested elements is greater than or equal to
|
||||||
@ -492,7 +492,6 @@ void spopWithCountCommand(client *c) {
|
|||||||
/* Propagate this command as a DEL operation */
|
/* Propagate this command as a DEL operation */
|
||||||
rewriteClientCommandVector(c,2,shared.del,c->argv[1]);
|
rewriteClientCommandVector(c,2,shared.del,c->argv[1]);
|
||||||
signalModifiedKey(c,c->db,c->argv[1]);
|
signalModifiedKey(c,c->db,c->argv[1]);
|
||||||
server.dirty++;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,7 +593,6 @@ void spopWithCountCommand(client *c) {
|
|||||||
decrRefCount(propargv[0]);
|
decrRefCount(propargv[0]);
|
||||||
preventCommandPropagation(c);
|
preventCommandPropagation(c);
|
||||||
signalModifiedKey(c,c->db,c->argv[1]);
|
signalModifiedKey(c,c->db,c->argv[1]);
|
||||||
server.dirty++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void spopCommand(client *c) {
|
void spopCommand(client *c) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user