re-fix config rewrite for empty save directive (#8722)
the bug was also discussed in #8716, and was solved in #8719, but incompletely: when the server is started, and the save option is default, if you issue the " config set save "" " to change the save option, and then issue the “config rewrite” command, the " save "" " won't be saved.
This commit is contained in:
parent
259eb03afb
commit
265f82d08f
@ -1385,7 +1385,7 @@ void rewriteConfigSaveOption(struct rewriteConfigState *state) {
|
|||||||
* defaults from being used.
|
* defaults from being used.
|
||||||
*/
|
*/
|
||||||
if (!server.saveparamslen) {
|
if (!server.saveparamslen) {
|
||||||
rewriteConfigRewriteLine(state,"save",sdsnew("save \"\""),0);
|
rewriteConfigRewriteLine(state,"save",sdsnew("save \"\""),1);
|
||||||
} else {
|
} else {
|
||||||
for (j = 0; j < server.saveparamslen; j++) {
|
for (j = 0; j < server.saveparamslen; j++) {
|
||||||
line = sdscatprintf(sdsempty(),"save %ld %d",
|
line = sdscatprintf(sdsempty(),"save %ld %d",
|
||||||
|
@ -190,6 +190,14 @@ start_server {tags {"introspection"}} {
|
|||||||
r config rewrite
|
r config rewrite
|
||||||
restart_server 0 true false
|
restart_server 0 true false
|
||||||
assert_equal [r config get save] {save {}}
|
assert_equal [r config get save] {save {}}
|
||||||
|
|
||||||
|
start_server {config "minimal.conf"} {
|
||||||
|
assert_equal [r config get save] {save {3600 1 300 100 60 10000}}
|
||||||
|
r config set save ""
|
||||||
|
r config rewrite
|
||||||
|
restart_server 0 true false
|
||||||
|
assert_equal [r config get save] {save {}}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Config file at this point is at a wierd state, and includes all
|
# Config file at this point is at a wierd state, and includes all
|
||||||
|
Loading…
x
Reference in New Issue
Block a user