Incrementally flush RDB on disk while loading it from a master.

This fixes issue #539.

Basically if there is enough free memory the OS may buffer the RDB file
that the slave transfers on disk from the master. The file may
actually be flused on disk at once by the operating system when it gets
closed by Redis, causing the close system call to block for a long time.

This patch is a modified version of one provided by yoav-steinberg of
@garantiadata (the original version was posted in the issue #539
comments), and tries to flush the OS buffers incrementally (every 8 MB
of loaded data).
This commit is contained in:
antirez
2012-08-24 19:28:44 +02:00
parent 06bd3b9acd
commit 13732168a5
5 changed files with 45 additions and 12 deletions

View File

@ -3,6 +3,10 @@
#define _BSD_SOURCE
#if defined(__linux__)
#define _GNU_SOURCE
#endif
#if defined(__linux__) || defined(__OpenBSD__)
#define _XOPEN_SOURCE 700
#else