Files
Kim Altintop 2af138fb8f commitlog: Truncate segment before resuming (#5116)
`read_exact` doesn't distinguish between EOF and not enough bytes to
fill the given buffer. We may thus consider a segment valid to be
resumed, but leave in trailing bytes (less than the commit header
length). That can cause silent data loss, because appending more data
will render the segment corrupt: a restart will then start a new
segment, leaving anything after the trailing bytes unreachable.

To fix this, truncate the segment to the size determined by
`Metadata::extract` before resuming writes.

# Expected complexity level and risk

2

# Testing

Added a test
2026-05-28 13:23:53 +00:00
..
2025-03-31 22:00:52 +00:00