summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2012-07-27 03:56:48 -0700
committerSalvatore Sanfilippo <antirez@gmail.com>2012-07-27 03:56:48 -0700
commited7b308c1c369d7a004b6f7a72e01ad1eddb5ac3 (patch)
treea92258d241c0d8a957cdd696e6a19139295bf410
parent04950a9e4dfb74a132e523ccbb7932a2394b832a (diff)
parent55302e9e285d13ae5eda021420d1a3ea6ca21afc (diff)
downloadredis-ed7b308c1c369d7a004b6f7a72e01ad1eddb5ac3.tar.gz
Merge pull request #587 from saj/truncate-short-write-from-aof
Truncate short write from the AOF
-rw-r--r--src/aof.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/aof.c b/src/aof.c
index 1df60b941..441ccaf18 100644
--- a/src/aof.c
+++ b/src/aof.c
@@ -250,6 +250,13 @@ void flushAppendOnlyFile(int force) {
strerror(errno),
(long)nwritten,
(long)sdslen(server.aof_buf));
+
+ if (ftruncate(server.aof_fd, server.aof_current_size) == -1) {
+ redisLog(REDIS_WARNING, "Could not remove short write "
+ "from the append-only file. Redis may refuse "
+ "to load the AOF the next time it starts. "
+ "ftruncate: %s", strerror(errno));
+ }
}
exit(1);
}