mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-26 08:18:18 +00:00
2adf33fcd2
fix(targets): surface truncated store batches instead of silently returning partial entries (backlog#967) get_multiple deserializes a persisted batch by pulling item_count items from a concatenated JSON stream. When the stream ended early (a truncated or corrupted batch file), the partial-read branch only logged a warn! and broke out of the loop, returning Ok(partial). Callers then treated the batch as fully delivered, deleted the store entry, and permanently lost the remaining events with no error. Return StoreError::Deserialization as soon as the stream ends before item_count items are read, so the caller keeps the entry on disk and can retry rather than silently dropping events. The empty-file case already returned an error and remains covered by this path. Add a regression test that writes a 3-item batch, truncates the file at a clean boundary after two items, and asserts get_multiple returns Err and leaves the batch file in place. Refs: https://github.com/rustfs/backlog/issues/967