Mutable ID tracker: truncate mappings file if last entry is partial#6173
Merged
Mutable ID tracker: truncate mappings file if last entry is partial#6173
Conversation
18 tasks
05172b4 to
1c38a5d
Compare
b0f0b13 to
4e20e69
Compare
ffuugoo
reviewed
Mar 17, 2025
ffuugoo
approved these changes
Mar 17, 2025
9 tasks
40c187d to
0ba670f
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
generall
reviewed
Mar 18, 2025
generall
approved these changes
Mar 18, 2025
timvisee
added a commit
that referenced
this pull request
Mar 21, 2025
…6173) * Keep track of how many bytes are read, truncate mappings on last partial * Rely on reader position to detect incomplete entry at the end * Fix typo * Handle edge case properly, don't truncate file if fully read * minor fix * Add test to assert operation size equals bytes read from stream * Functions can be constant * Fix some nitpicks --------- Co-authored-by: generall <andrey@vasnetsov.com>
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.
Tracked in: #6157
Depends on: #6169
If the last entry in the mappings file is partial, truncate the file.
It can happen if we crash during flush. We must truncate the file so that newly appended mappings don't get corrupted.
I don't particularly like the implementation, but the tools here are a bit limited. An alternative approach would require to load the full file in memory, or it would require to read over the file twice, which is why I implemented the current approach instead.
Tasks
devAll Submissions:
devbranch. Did you create your branch fromdev?New Feature Submissions:
cargo +nightly fmt --allcommand prior to submission?cargo clippy --all --all-featurescommand?Changes to Core Features: