fix: safer sizing for partial segment metadata header, simplify bootstrap - #20105
Open
clintropolis wants to merge 6 commits into
Open
fix: safer sizing for partial segment metadata header, simplify bootstrap#20105clintropolis wants to merge 6 commits into
clintropolis wants to merge 6 commits into
Conversation
FrankChen021
left a comment
Member
There was a problem hiding this comment.
I have reviewed the code for correctness, edge cases, concurrency, and integration risks; no issues found.
Reviewed 9 of 9 changed files.
This is an automated review by Codex GPT-5.6-Luna(max)
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.
Description
This PR fixes partial segment metadata handling to ensure consistent metadata header file sizes and guards to ensure that files are complete. First, partial entry mounting now writes atomically the metadata header and the bitmap that tracks which files have been loaded (instead of writing the metadata and then appending the bitmap).
While here, I have simplified partial segment bootstrapping to use the same flow that on-demand loading uses, instead of handling it separately, which means that bootstrapping a partial entry reserves at the same time as mounting instead of reserving everything up front. The switch to using the shared path means that in hopefully rare edge cases bootstrap could unintentionally evict segments that were already present in cache (though never anything that is held under a partial load rule); if this is a problem in practice we could switch to a solution that uses the files on disk to use as the estimate instead of the config estimate (16 MiB default which is waaaay bigger than most metadatas i've seen so far which are usually 1-10kb). Similarly complete entries also do their mount under a hold, so
StorageLocation#reserveWeakwas no longer needed and has been removed, making it so that all mounts of weak entries are done while holding a hold.