Schalk-Willem Kruger 3d33da75ef Fix UnmarkEOF for partial blocks
Summary:
Blocks in the transaction log are a fixed size, but the last block in the transaction log file is usually a partial block. When a new record is added after the reader hit the end of the file, a new physical record will be appended to the last block. ReadPhysicalRecord can only read full blocks and assumes that the file position indicator is aligned to the start of a block. If the reader is forced to read further by simply clearing the EOF flag, ReadPhysicalRecord will read a full block starting from somewhere in the middle of a real block, causing it to lose alignment and to have a partial physical record at the end of the read buffer. This will result in length mismatches and checksum failures. When the log file is tailed for replication this will cause the log iterator to become invalid, necessitating the creation of a new iterator which will have to read the log file from scratch.

This diff fixes this issue by reading the remaining portion of the last block we read from. This is done when the reader is forced to read further (UnmarkEOF is called).

Test Plan:
- Added unit tests
- Stress test (with replication). Check dbdir/LOG file for corruptions.
- Test on test tier

Reviewers: emayanke, haobo, dhruba

Reviewed By: haobo

CC: vamsi, sheki, dhruba, kailiu, igor

Differential Revision: https://reviews.facebook.net/D15249
2014-01-27 14:49:10 -08:00
..
2013-12-10 10:48:35 +02:00
2014-01-22 10:55:16 -08:00
2014-01-22 10:55:16 -08:00
2013-10-28 17:54:09 -07:00
2014-01-22 10:45:26 -08:00
2013-12-03 11:17:58 -08:00
2013-10-28 17:54:09 -07:00
2013-10-25 08:32:14 -07:00
2014-01-27 14:49:10 -08:00
2014-01-27 14:49:10 -08:00
2014-01-27 14:49:10 -08:00
2014-01-17 12:46:06 -08:00
2014-01-17 12:46:06 -08:00
2013-12-03 12:42:15 -08:00
2013-12-03 12:42:15 -08:00
2014-01-14 15:27:09 -08:00
2014-01-23 16:26:08 -08:00
2014-01-16 14:06:53 -08:00
2014-01-16 14:06:53 -08:00
2014-01-17 12:46:06 -08:00