Commits

Douglas Adam Creager authored fbab55fdd49
AVRO-818. C: Fix data file corruption bug This patch fixes the C library's data file writer to produce correct files when there are enough records to produce multiple blocks in the file. The logic in datafile.c is that we have a fixed-buffer in-memory avro_writer_t instance. When you append records to the data file, they go into this memory buffer. If we get an error serializing into the memory buffer, it's presumably because we've filled it, so we write out the memory buffer's contents as a new block in the file, clear the buffer, and try again. The problem is that the failed serialization into the memory buffer isn't atomic; some of the serialization will have made it into the buffer before we discover that there's not enough room. Before, this incomplete record would then make it into the file. To fix this, we keep track of the size of the in-memory buffer after the most recent successfully serialized record, and use this as the block size when we write a block to disk. This ensures that even if there's any incomplete records at the end of the memory buffer, we don't include them in the block. git-svn-id: https://svn.apache.org/repos/asf/avro/trunk@1102332 13f79535-47bb-0310-9956-ffa450edef68