Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
0a0fd37e
Commit
0a0fd37e
authored
Jun 27, 2013
by
antirez
Browse files
Allow SHUTDOWN in loading state.
parent
7bfbc380
Changes
2
Show whitespace changes
Inline
Side-by-side
src/db.c
View file @
0a0fd37e
...
@@ -353,6 +353,12 @@ void shutdownCommand(redisClient *c) {
...
@@ -353,6 +353,12 @@ void shutdownCommand(redisClient *c) {
return
;
return
;
}
}
}
}
/* SHUTDOWN can be called even while the server is in "loading" state.
* When this happens 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). */
if
(
server
.
loading
)
flags
=
(
flags
&
~
REDIS_SHUTDOWN_SAVE
)
|
REDIS_SHUTDOWN_NOSAVE
;
if
(
prepareForShutdown
(
flags
)
==
REDIS_OK
)
exit
(
0
);
if
(
prepareForShutdown
(
flags
)
==
REDIS_OK
)
exit
(
0
);
addReplyError
(
c
,
"Errors trying to SHUTDOWN. Check logs."
);
addReplyError
(
c
,
"Errors trying to SHUTDOWN. Check logs."
);
}
}
...
...
src/redis.c
View file @
0a0fd37e
...
@@ -213,7 +213,7 @@ struct redisCommand redisCommandTable[] = {
...
@@ -213,7 +213,7 @@ struct redisCommand redisCommandTable[] = {
{
"save"
,
saveCommand
,
1
,
"ars"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"save"
,
saveCommand
,
1
,
"ars"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"bgsave"
,
bgsaveCommand
,
1
,
"ar"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"bgsave"
,
bgsaveCommand
,
1
,
"ar"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"bgrewriteaof"
,
bgrewriteaofCommand
,
1
,
"ar"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"bgrewriteaof"
,
bgrewriteaofCommand
,
1
,
"ar"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"shutdown"
,
shutdownCommand
,
-
1
,
"ar"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"shutdown"
,
shutdownCommand
,
-
1
,
"ar
l
"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"lastsave"
,
lastsaveCommand
,
1
,
"rR"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"lastsave"
,
lastsaveCommand
,
1
,
"rR"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"type"
,
typeCommand
,
2
,
"r"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"type"
,
typeCommand
,
2
,
"r"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"multi"
,
multiCommand
,
1
,
"rs"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"multi"
,
multiCommand
,
1
,
"rs"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
...
...
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