summaryrefslogtreecommitdiff
path: root/src/aof.c
diff options
context:
space:
mode:
authorWen Hui <wen.hui.ware@gmail.com>2022-11-22 09:18:36 -0500
committerGitHub <noreply@github.com>2022-11-22 16:18:36 +0200
commit6e9724cb6a8ff2bad4c8aeb591ee0d14120ca7af (patch)
tree0c208e706710f6651b987c84f153fb3287d26c7d /src/aof.c
parent3f8756a06ae48258779ffc7cbef605a3ec0a926f (diff)
downloadredis-6e9724cb6a8ff2bad4c8aeb591ee0d14120ca7af.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.
Diffstat (limited to 'src/aof.c')
-rw-r--r--src/aof.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/aof.c b/src/aof.c
index 2d1e1c441..c5a47ab46 100644
--- a/src/aof.c
+++ b/src/aof.c
@@ -1694,6 +1694,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) {
@@ -1724,8 +1725,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) {