Commit e615539c authored by antirez's avatar antirez
Browse files

aofChildWriteDiffData() better handling of free blocks.

parent f0a58bfa
...@@ -104,10 +104,13 @@ void aofChildWriteDiffData(aeEventLoop *el, int fd, void *privdata, int mask) { ...@@ -104,10 +104,13 @@ void aofChildWriteDiffData(aeEventLoop *el, int fd, void *privdata, int mask) {
AE_WRITABLE); AE_WRITABLE);
return; return;
} }
nwritten = write(server.aof_pipe_write_data_to_child,block->buf,block->used); if (block->used > 0) {
if (nwritten <= 0) return; nwritten = write(server.aof_pipe_write_data_to_child,
memmove(block->buf,block->buf+nwritten,block->used-nwritten); block->buf,block->used);
block->used -= nwritten; 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); if (block->used == 0) listDelNode(server.aof_rewrite_buf_blocks,ln);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment