Use server.dirty++ instead if forceCommandPropagation on FUNCTION commands (#9945)

Functions are considered data, so changing a function should be counted
as a data change and should affect the persistence policy. For example
if we want to persist an RDB each minute if there was a single change,
functions should be counted as such change. Using `forceCommandPropagation`
will not give us the desired effect and so we must switch to `server.dirty++`
This commit is contained in:
Meir Shpilraien (Spielrein) 2021-12-15 19:17:10 +02:00 committed by GitHub
parent 95f943add6
commit fbfdf513d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -314,7 +314,9 @@ void functionsDeleteCommand(client *c) {
}
engineFunctionFree(fi, functions_ctx);
forceCommandPropagation(c, PROPAGATE_REPL | PROPAGATE_AOF);
/* Indicate that the command changed the data so it will be replicated and
* counted as a data change (for persistence configuration) */
server.dirty++;
addReply(c, shared.ok);
}
@ -484,7 +486,9 @@ void functionsCreateCommand(client *c) {
addReplyErrorSds(c, err);
return;
}
forceCommandPropagation(c, PROPAGATE_REPL | PROPAGATE_AOF);
/* Indicate that the command changed the data so it will be replicated and
* counted as a data change (for persistence configuration) */
server.dirty++;
addReply(c, shared.ok);
}