Skip to content

fix: safer sizing for partial segment metadata header, simplify bootstrap - #20105

Open
clintropolis wants to merge 6 commits into
apache:masterfrom
clintropolis:fix-partial-metadata-sizing
Open

fix: safer sizing for partial segment metadata header, simplify bootstrap#20105
clintropolis wants to merge 6 commits into
apache:masterfrom
clintropolis:fix-partial-metadata-sizing

Conversation

@clintropolis

@clintropolis clintropolis commented Aug 21, 2026

Copy link
Copy Markdown
Member

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#reserveWeak was no longer needed and has been removed, making it so that all mounts of weak entries are done while holding a hold.

@FrankChen021 FrankChen021 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants