Skip to content

Commit

Permalink
do not add save parameter during config rewrite in sentinel mode (#7945)
Browse files Browse the repository at this point in the history
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 0f370f9)
  • Loading branch information
hwware authored and oranagra committed Oct 27, 2020
1 parent cebc1f2 commit c6c2de9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit c6c2de9

Please sign in to comment.