Inconsistent RDB saving when in Sentinel mode#7411
Merged
antirez merged 1 commit intoredis:unstablefrom Jun 18, 2020
Merged
Conversation
- enforcing of SHUTDOWN_NOSAVE flag in one place to make it consitent when running in Sentinel mode
Contributor
|
Good catch @tporadowski, thanks. |
JackieXie168
pushed a commit
to JackieXie168/redis
that referenced
this pull request
Jul 1, 2020
…osave Inconsistent RDB saving when in Sentinel mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue description:
When Redis is running in Sentinel mode - shutting down of the server behaves differently in case of:
SHUTDOWNcommand - saving of RDB is explicitly disabled via checking(server.loading || server.sentinel_mode), which setsSHUTDOWN_NOSAVEflagSIGINT/SIGTERM signal- althoughSHUTDOWN_NOFLAGSis being used in call toprepareForShutdown()- using improper configuration file that defines at least 1save ...option triggers RDB saving, thus in turn could lead to overwriting of an existing RDB file with an empty one (as loading data is skipped in Sentinel mode).Steps to reproduce:
This can be easily reproduced by running e.g.
redis-server redis.conf --port 9876 --sentinel(using defaultredis.confwithsave ...options) and then stopping it viactrl+c- RDB is saved although it must not.Issue elimination:
This change moves the check mentioned in regard to
SHUTDOWNcommand toprepareForShutdown(), so Sentinel mode is checked consistently in both cases.