Unverified Commit 66bed3f2 authored by Binbin's avatar Binbin Committed by GitHub
Browse files

When DEBUG LOADAOF fails, return an error instead of exiting (#11790)

Return an error when loadAppendOnlyFiles fails instead of
exiting. DEBUF LOADAOF command is only meant to be used by
the test suite, and only by tests that generated an AOF file
first. So this change is ok (considering that the caller is
likely to catch this error and die).

This actually revert part of the code in #9012, and now
DEBUG LOADAOF behaves the same as DEBUG RELOAD (returns an
error when the load fails).

Plus remove a `after 2000` in a test, which can save times (looks like copy paste error).
parent f3c6f9c2
...@@ -585,9 +585,11 @@ NULL ...@@ -585,9 +585,11 @@ NULL
aofLoadManifestFromDisk(); aofLoadManifestFromDisk();
aofDelHistoryFiles(); aofDelHistoryFiles();
int ret = loadAppendOnlyFiles(server.aof_manifest); int ret = loadAppendOnlyFiles(server.aof_manifest);
if (ret != AOF_OK && ret != AOF_EMPTY)
exit(1);
unprotectClient(c); unprotectClient(c);
if (ret != AOF_OK && ret != AOF_EMPTY) {
addReplyError(c, "Error trying to load the AOF files, check server logs.");
return;
}
server.dirty = 0; /* Prevent AOF / replication */ server.dirty = 0; /* Prevent AOF / replication */
serverLog(LL_WARNING,"Append Only File loaded by DEBUG LOADAOF"); serverLog(LL_WARNING,"Append Only File loaded by DEBUG LOADAOF");
addReply(c,shared.ok); addReply(c,shared.ok);
......
...@@ -603,9 +603,9 @@ start_server {tags {"expire"}} { ...@@ -603,9 +603,9 @@ start_server {tags {"expire"}} {
} {-1} } {-1}
test {GETEX use of PERSIST option should remove TTL after loadaof} { test {GETEX use of PERSIST option should remove TTL after loadaof} {
r config set appendonly yes
r set foo bar EX 100 r set foo bar EX 100
r getex foo PERSIST r getex foo PERSIST
after 2000
r debug loadaof r debug loadaof
r ttl foo r ttl foo
} {-1} {needs:debug} } {-1} {needs:debug}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment