Commit e7893842 authored by antirez's avatar antirez
Browse files

Fix CONFIG REWRITE handling of unknown options.

There were two problems with the implementation.

1) "save" was not correctly processed when no save point was configured,
   as reported in issue #1416.
2) The way the code checked if an option existed in the "processed"
   dictionary was wrong, as we add the element with as a key associated
   with a NULL value, so dictFetchValue() can't be used to check for
   existance, but dictFind() must be used, that returns NULL only if the
   entry does not exist at all.
parent 7e9433ce
...@@ -1440,6 +1440,8 @@ void rewriteConfigSaveOption(struct rewriteConfigState *state) { ...@@ -1440,6 +1440,8 @@ void rewriteConfigSaveOption(struct rewriteConfigState *state) {
server.saveparams[j].seconds, server.saveparams[j].changes); server.saveparams[j].seconds, server.saveparams[j].changes);
rewriteConfigRewriteLine(state,"save",line,1); rewriteConfigRewriteLine(state,"save",line,1);
} }
/* Mark "save" as processed in case server.saveparamslen is zero. */
rewriteConfigMarkAsProcessed(state,"save");
} }
/* Rewrite the dir option, always using absolute paths.*/ /* Rewrite the dir option, always using absolute paths.*/
...@@ -1578,7 +1580,7 @@ void rewriteConfigRemoveOrphaned(struct rewriteConfigState *state) { ...@@ -1578,7 +1580,7 @@ void rewriteConfigRemoveOrphaned(struct rewriteConfigState *state) {
/* Don't blank lines about options the rewrite process /* Don't blank lines about options the rewrite process
* don't understand. */ * don't understand. */
if (dictFetchValue(state->rewritten,option) == NULL) { if (dictFind(state->rewritten,option) == NULL) {
redisLog(REDIS_DEBUG,"Not rewritten option: %s", option); redisLog(REDIS_DEBUG,"Not rewritten option: %s", option);
continue; continue;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment