summaryrefslogtreecommitdiff
path: root/src/rdb.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-10-17 11:36:12 +0200
committerantirez <antirez@gmail.com>2014-10-17 11:36:12 +0200
commit10aafdad56fa79bd7f95d9b190054b2e56b6cddd (patch)
treef5ab58cd684cde63040f3bdeedf2eff29ac24ada /src/rdb.c
parentb1337b15b6b090315d884d7372eea344926ae95b (diff)
downloadredis-10aafdad56fa79bd7f95d9b190054b2e56b6cddd.tar.gz
Diskless replication: rio fdset target new supports buffering.
To perform a socket write() for each RDB rio API write call was extremely unefficient, so now rio has minimal buffering capabilities. Writes are accumulated into a buffer and only when a given limit is reacehd are actually wrote to the N slaves FDs. Trivia: rio lacked support for buffering since our targets were: 1) Memory buffers. 2) C standard I/O. Both were buffered already.
Diffstat (limited to 'src/rdb.c')
-rw-r--r--src/rdb.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/rdb.c b/src/rdb.c
index 45beae14d..c6a1ec691 100644
--- a/src/rdb.c
+++ b/src/rdb.c
@@ -1425,6 +1425,9 @@ int rdbSaveToSlavesSockets(void) {
redisSetProcTitle("redis-rdb-to-slaves");
retval = rdbSaveRioWithEOFMark(&slave_sockets,NULL);
+ if (retval == REDIS_OK && rioFlush(&slave_sockets) == 0)
+ retval = REDIS_ERR;
+
if (retval == REDIS_OK) {
size_t private_dirty = zmalloc_get_private_dirty();