list and info no longer load every grain to count its chunks - #191
Merged
Merged
Conversation
summarize_store called grain::load on each store's grain to read chunk_count() and discard the rest: the whole file, plus a copy of every filter. list walks the stores one after another, so its peak was about twice the largest grain. grain::coverage returns the grain's size and chunk count from the commit when it still describes the file, otherwise from one buffered walk. It opens nothing for writing, so list stays usable on a store it can only read. Three stores with grains of 68, 17 and 17 MB: list peaked at 145 MB before, 7 MB after. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.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.
Problem
summarize_store(behindlist,infoandlist --json) calledgrain::loadon each store's grain to readchunk_count()and discard the rest: the whole file, plus a copy of every filter into its ownVec.listhandles stores one after another, so its peak was about twice the largest grain, not the sum. On a host with a multi-GB grain that is several GB for a command that is documented as read-only and cheap.Change
grain::coverage(dir, name)returns the grain's size and chunk count from the commit (#189) when it still describes the file, otherwise from one buffered forward walk. It opens nothing for writing and never creates or updates a commit, solistkeeps working on a store it can only read.Measured
Three stores, grains of 68, 17 and 17 MB:
Cold,
liststill reads each grain once, with a bounded buffer. It created no commit files, and it works on a read-only directory.Tests
coverageagrees with loading the grain, with and without a commit, and does not write one; it ignores a torn tail; it isNonefor a missing or non-grain file.Not in this PR
query --hasandservestill callgrain::loadand hold about twice the grain. They need the filters, so streaming them is a separate change.🤖 Generated with Claude Code