Skip to content
This repository
Browse code

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

Truncate short write from the AOF
  • Loading branch information...
commit ed7b308c1c369d7a004b6f7a72e01ad1eddb5ac3 2 parents 04950a9 + 55302e9
Salvatore Sanfilippo authored

Showing 1 changed file with 7 additions and 0 deletions. Show diff stats Hide diff stats

  1. +7 0 src/aof.c
7 src/aof.c
@@ -250,6 +250,13 @@ void flushAppendOnlyFile(int force) {
250 250 strerror(errno),
251 251 (long)nwritten,
252 252 (long)sdslen(server.aof_buf));
  253 +
  254 + if (ftruncate(server.aof_fd, server.aof_current_size) == -1) {
  255 + redisLog(REDIS_WARNING, "Could not remove short write "
  256 + "from the append-only file. Redis may refuse "
  257 + "to load the AOF the next time it starts. "
  258 + "ftruncate: %s", strerror(errno));
  259 + }
253 260 }
254 261 exit(1);
255 262 }

0 comments on commit ed7b308

Please sign in to comment.
Something went wrong with that request. Please try again.