mirror of
https://github.com/fluencelabs/redis
synced 2025-04-27 11:32:13 +00:00
Fix DEBUG LOADAOF so that redis-server will not crash unexpectedly
and will not be inconsistent after we call debug loadaof. Before this commit, there were 2 problems: 1, When appendonly is set to no and there is not a appendonly file, redis-server will crash if we call DEBUG LOADAOF. 2, When appendonly is set to no and there is a appendonly file, redis-server will hold different data after loading appendonly file.
This commit is contained in:
parent
86de089a1e
commit
7d269d5e63
@ -347,7 +347,11 @@ NULL
|
|||||||
serverLog(LL_WARNING,"DB reloaded by DEBUG RELOAD");
|
serverLog(LL_WARNING,"DB reloaded by DEBUG RELOAD");
|
||||||
addReply(c,shared.ok);
|
addReply(c,shared.ok);
|
||||||
} else if (!strcasecmp(c->argv[1]->ptr,"loadaof")) {
|
} else if (!strcasecmp(c->argv[1]->ptr,"loadaof")) {
|
||||||
if (server.aof_state == AOF_ON) flushAppendOnlyFile(1);
|
if (server.aof_state == AOF_OFF) {
|
||||||
|
addReply(c, shared.err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
flushAppendOnlyFile(1);
|
||||||
emptyDb(-1,EMPTYDB_NO_FLAGS,NULL);
|
emptyDb(-1,EMPTYDB_NO_FLAGS,NULL);
|
||||||
if (loadAppendOnlyFile(server.aof_filename) != C_OK) {
|
if (loadAppendOnlyFile(server.aof_filename) != C_OK) {
|
||||||
addReply(c,shared.err);
|
addReply(c,shared.err);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user