summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWen Hui <wen.hui.ware@gmail.com>2022-11-22 09:18:36 -0500
committerOran Agra <oran@redislabs.com>2022-12-12 17:36:34 +0200
commitd81c2a5f331e1e0d5cab27890828f01d2284cdc0 (patch)
treeaba4183a9374bb8b01f41cc68ee2c8180252a87e
parenta26ac7ebbc55b1b49ec62b31adb277756d57a7db (diff)
downloadredis-d81c2a5f331e1e0d5cab27890828f01d2284cdc0.tar.gz
Add explicit error log message for AOF_TRUNCATED status when server load AOF file (#11484)
Now, according to the comments, if the truncated file is not the last file, it will be considered as a fatal error. And the return code will updated to AOF_FAILED, then server will exit without any error message to the client. Similar to other error situations, this PR add an explicit error message for this case and make the client know clearly what happens. (cherry picked from commit 6e9724cb6a8ff2bad4c8aeb591ee0d14120ca7af)
-rw-r--r--src/aof.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/aof.c b/src/aof.c
index 482ec786d..badf62c46 100644
--- a/src/aof.c
+++ b/src/aof.c
@@ -1685,6 +1685,7 @@ int loadAppendOnlyFiles(aofManifest *am) {
/* If the truncated file is not the last file, we consider this to be a fatal error. */
if (ret == AOF_TRUNCATED && !last_file) {
ret = AOF_FAILED;
+ serverLog(LL_WARNING, "Fatal error: the truncated file is not the last file");
}
if (ret == AOF_OPEN_ERR || ret == AOF_FAILED) {
@@ -1715,8 +1716,10 @@ int loadAppendOnlyFiles(aofManifest *am) {
* so empty incr AOF file doesn't count as a AOF_EMPTY result */
if (ret == AOF_EMPTY) ret = AOF_OK;
+ /* If the truncated file is not the last file, we consider this to be a fatal error. */
if (ret == AOF_TRUNCATED && !last_file) {
ret = AOF_FAILED;
+ serverLog(LL_WARNING, "Fatal error: the truncated file is not the last file");
}
if (ret == AOF_OPEN_ERR || ret == AOF_FAILED) {