From fbfdf513d275e1199bcf0196f1b5bb59898fb75f Mon Sep 17 00:00:00 2001 From: "Meir Shpilraien (Spielrein)" Date: Wed, 15 Dec 2021 19:17:10 +0200 Subject: [PATCH] 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++` --- src/functions.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/functions.c b/src/functions.c index b0d7a23052..01c71b53c7 100644 --- a/src/functions.c +++ b/src/functions.c @@ -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); }