diff options
author | Wen Hui <wen.hui.ware@gmail.com> | 2020-10-22 12:47:32 -0400 |
---|---|---|
committer | Oran Agra <oran@redislabs.com> | 2020-10-27 09:12:01 +0200 |
commit | c6c2de95671d80eef7331eab0a1e2d9958e7d116 (patch) | |
tree | edf39d0d48cd38a2988acf5168891d96af069663 | |
parent | cebc1f2696fe3b58009c813ce28b27b98f9b4209 (diff) | |
download | redis-c6c2de95671d80eef7331eab0a1e2d9958e7d116.tar.gz |
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 0f370f9b667fab4bede084f1b8b47c93f0d56069)
-rw-r--r-- | src/config.c | 6 |
1 files changed, 6 insertions, 0 deletions
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. */ |