mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-06-27 08:18:48 -04:00
2af138fb8f
`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
⚠️ Internal Crate ⚠️
This crate is intended for internal use only. It is not stable and may change without notice.