Repository navigation
refactor(storage): load index registry once in IndexReader constructor - #568
Open
eguguchkin wants to merge 2 commits into
Open
eguguchkin wants to merge 2 commits into
eguguchkin wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #568 +/- ##
==========================================
- Coverage 79.21% 79.21% -0.01%
==========================================
Files 249 249
Lines 18844 18828 -16
==========================================
- Hits 14927 14914 -13
+ Misses 3917 3914 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
eguguchkin
requested review from
dkharms and
forshev
and removed request for
dkharms
October 8, 2026 14:13
dkharms
approved these changes
Oct 8, 2026
forshev
approved these changes
Oct 9, 2026
This branch has not been deployed
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
The index registry (the block-header table of an index file) was previously loaded lazily through a cache.Cache[[]byte], so every BlocksCount() / GetBlockHeader() call took a cache lookup guarded by a mutex. On the frac-load path these calls are frequent and concurrent across readers, and mutex contention on the shared cache entry made them measurably expensive.
This PR loads the registry once in NewIndexReader into a plain registry []byte field. Since the registry is immutable for the lifetime of the reader, reads are now lock-free — the mutex is paid once per reader instead of on every access.
As a side effect, BlocksCount() becomes infallible (int instead of (int, error)), so error handling disappears from frac/sealed_loader.go and frac/sealed/token/table_loader.go.
If you have used LLM/AI assistance please provide model name and full prompt: