diff options
author | antirez <antirez@gmail.com> | 2014-07-05 01:11:28 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2014-07-05 01:11:28 +0200 |
commit | 93cd75bbe084f5d94bbf6216200820ff0b2785fe (patch) | |
tree | 580f3752415162c101910da5342c7b0f15290872 /src | |
parent | ac33c049c647cbe09b424cff5755504fddc0b4c7 (diff) | |
download | redis-93cd75bbe084f5d94bbf6216200820ff0b2785fe.tar.gz |
aofChildWriteDiffData() better handling of free blocks.
Diffstat (limited to 'src')
-rw-r--r-- | src/aof.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -104,10 +104,13 @@ void aofChildWriteDiffData(aeEventLoop *el, int fd, void *privdata, int mask) { AE_WRITABLE); return; } - nwritten = write(server.aof_pipe_write_data_to_child,block->buf,block->used); - if (nwritten <= 0) return; - memmove(block->buf,block->buf+nwritten,block->used-nwritten); - block->used -= nwritten; + if (block->used > 0) { + nwritten = write(server.aof_pipe_write_data_to_child, + block->buf,block->used); + if (nwritten <= 0) return; + memmove(block->buf,block->buf+nwritten,block->used-nwritten); + block->used -= nwritten; + } if (block->used == 0) listDelNode(server.aof_rewrite_buf_blocks,ln); } } |