Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not an expert of the config rewrite (didn't deal with it in the past).
it looks to me that a slightly cleaner way would be to just add the condition on the call to
rewriteConfigSaveOption
.i.e. since the original config file isn't expected to have the save config, we don't need to
rewriteConfigMarkAsProcessed
.@hwware do you care to test it, or correct me if i'm wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @oranagra, yes both these two ways will work. the reason i added the check in the function is I was thinking about consistency, since some other functions such as https://github.com/redis/redis/blob/unstable/src/config.c#L1400 the check condition added inside the function. But for sentinel mode the codition is simplier indeed, I agree if we add check in the calling place of rewriteConfigSaveOption may make code looks more consise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but just let you know there are also some trivial difference here, if we put the check when we calling the rewriteConfigSaveOption, it won't touch any existing "save" parameters in sentinel configuration, however if we added the check inside the function and if we mistakenly put "save " inside sentinel config, this will be overwritten by blank. In my opinion both way works since we need to make sure the "save" willl not be re-added in the config, if user mistakenly put it in sentinel conf, we can igore it or not ignore it both seems ok to me.. how do you think? @oranagra
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hwware good point about the fact that there's a precedence that does that, but as you pointed out, it's a slightly different scenario (slaveof does have a purpose there, and might indeed needs to be removed, unlike here which is a pointless line).
If it was about removing or not removing a line that the user might have put there, I would have said not to remove it.
But indeed as you pointed out, this config wasn't put there by the user, but rather by our bug.
So if this were a new config invented by the next version of Redis, I would go with my suggested way (cleaner code), but since we need to clean up junk from old config files we generated, let's take your way.