Repository navigation
Persist storage metadata when closing writers - #922
Merged
david-zwicker merged 3 commits intoOct 19, 2026
Merged
Conversation
- Save the current length before subsequent readers and appends reopen files. - Reopen closed handles for finalization while preserving final metadata. - Cover incremental reads, resumed appends and repeated finalization.
- Store the actual zero length when no frames have been written. - Cover empty fixed-size files with both handle modes and compression.
…e method handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FileStorage(keep_opened=False)closes its handle after each append, butend_writingthen tries to write attributes through that closed handle. A simulation using this option fails during finalization. When resuming an existing file, its staledata_lengthcan also cause later appends to overwrite the same frame.Persist writer metadata and its actual length when closing the file, including empty preallocated histories. Reopen the handle for finalization while retaining information updated since the last append. Explicit close/resume paths use the same metadata rule.
Regressions cover finalization, updated metadata, repeated finalization, independent readers between appends, and resumed writes with fixed/extensible and compressed/uncompressed files. Native real and complex diffusion/wave runs resumed over three segments retain every callback snapshot; solver outputs stay unchanged.
File-storage tests, the storage/tracker/diffusion/wave checks, and project hooks pass. Whole-project Mypy reports the same diagnostics as unchanged upstream.