Skip to content

Inconsistent RDB saving when in Sentinel mode#7411

Merged
antirez merged 1 commit intoredis:unstablefrom
tporadowski:inconsitent-sentinel-nosave
Jun 18, 2020
Merged

Inconsistent RDB saving when in Sentinel mode#7411
antirez merged 1 commit intoredis:unstablefrom
tporadowski:inconsitent-sentinel-nosave

Conversation

@tporadowski
Copy link
Contributor

Issue description:
When Redis is running in Sentinel mode - shutting down of the server behaves differently in case of:

  1. SHUTDOWN command - saving of RDB is explicitly disabled via checking (server.loading || server.sentinel_mode), which sets SHUTDOWN_NOSAVE flag
  2. SIGINT/SIGTERM signal - although SHUTDOWN_NOFLAGS is being used in call to prepareForShutdown() - using improper configuration file that defines at least 1 save ... 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 default redis.conf with save ... options) and then stopping it via ctrl+c - RDB is saved although it must not.

Issue elimination:
This change moves the check mentioned in regard to SHUTDOWN command to prepareForShutdown(), so Sentinel mode is checked consistently in both cases.

- enforcing of SHUTDOWN_NOSAVE flag in one place to make it consitent
  when running in Sentinel mode
@antirez
Copy link
Contributor

antirez commented Jun 18, 2020

Good catch @tporadowski, thanks.

@tporadowski tporadowski deleted the inconsitent-sentinel-nosave branch June 18, 2020 10:04
JackieXie168 pushed a commit to JackieXie168/redis that referenced this pull request Jul 1, 2020
…osave

Inconsistent RDB saving when in Sentinel mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants