Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
ab4cc1e1
Unverified
Commit
ab4cc1e1
authored
Jun 18, 2020
by
Salvatore Sanfilippo
Committed by
GitHub
Jun 18, 2020
Browse files
Merge pull request #7411 from tporadowski/inconsitent-sentinel-nosave
Inconsistent RDB saving when in Sentinel mode
parents
4b8d8826
4ee011ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
ab4cc1e1
...
...
@@ -963,14 +963,6 @@ void shutdownCommand(client *c) {
return
;
}
}
/* When SHUTDOWN is called while the server is loading a dataset in
* memory we need to make sure no attempt is performed to save
* the dataset on shutdown (otherwise it could overwrite the current DB
* with half-read data).
*
* Also when in Sentinel mode clear the SAVE flag and force NOSAVE. */
if
(
server
.
loading
||
server
.
sentinel_mode
)
flags
=
(
flags
&
~
SHUTDOWN_SAVE
)
|
SHUTDOWN_NOSAVE
;
if
(
prepareForShutdown
(
flags
)
==
C_OK
)
exit
(
0
);
addReplyError
(
c
,
"Errors trying to SHUTDOWN. Check logs."
);
}
...
...
src/server.c
View file @
ab4cc1e1
...
...
@@ -3680,6 +3680,15 @@ void closeListeningSockets(int unlink_unix_socket) {
}
int
prepareForShutdown
(
int
flags
)
{
/* When SHUTDOWN is called while the server is loading a dataset in
* memory we need to make sure no attempt is performed to save
* the dataset on shutdown (otherwise it could overwrite the current DB
* with half-read data).
*
* Also when in Sentinel mode clear the SAVE flag and force NOSAVE. */
if
(
server
.
loading
||
server
.
sentinel_mode
)
flags
=
(
flags
&
~
SHUTDOWN_SAVE
)
|
SHUTDOWN_NOSAVE
;
int
save
=
flags
&
SHUTDOWN_SAVE
;
int
nosave
=
flags
&
SHUTDOWN_NOSAVE
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment