Permalink
Browse files

Merge pull request #587 from saj/truncate-short-write-from-aof

Truncate short write from the AOF
  • Loading branch information...
2 parents 04950a9 + 55302e9 commit ed7b308c1c369d7a004b6f7a72e01ad1eddb5ac3 @antirez committed Jul 27, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/aof.c
View
@@ -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);
}

0 comments on commit ed7b308

Please sign in to comment.