From 6b4aba30a9e1fdce6be0315e1eff19dd0783b188 Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Thu, 22 Oct 2020 12:47:32 -0400 Subject: [PATCH] do not add save parameter during config rewrite in sentinel mode (#7945) Previous code would have added default redis save parameters to the config file on rewrite, which would have been silently ignored when the config file is loaded. The new code avoids adding this, and also actively removes these lines If added by a previous config rewrite. (cherry picked from commit f61435fe8b7907f59cb0f11f28f13db50b9023a5) --- src/config.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/config.c b/src/config.c index 70cc50b64..4a956d698 100644 --- a/src/config.c +++ b/src/config.c @@ -1323,6 +1323,12 @@ void rewriteConfigSaveOption(struct rewriteConfigState *state) { int j; sds line; + /* In Sentinel mode we don't need to rewrite the save parameters */ + if (server.sentinel_mode) { + rewriteConfigMarkAsProcessed(state,"save"); + return; + } + /* Note that if there are no save parameters at all, all the current * config line with "save" will be detected as orphaned and deleted, * resulting into no RDB persistence as expected. */