You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thing is: dirtyFiles it's already a cache of files metadata - and we already do invalidate it by OpenFolder method. And it already works - even on external RPCD.
If somewhere we using unnecessary glob instead of dirty files lookup - then maybe just switch.
Thing is: dirtyFiles it's already a cache of files metadata - and we already do invalidate it by OpenFolder method. And it already works - even on external RPCD.
If somewhere we using unnecessary glob instead of dirty files lookup - then maybe just switch.
but to build the dirty files set we need to do open seg + open index..
rn now the open index process is slow because of glob (which we do for all data files) and it slows down the offline commands startup significantly (specially on gnosis which has lots of files, maybe it'd be worse for polygon if we were working on it).
sudeepdino008
changed the title
[wip] experiment with caching directory entries to avoid filepath.Glob for opening idx
cache directory entries to avoid expensive filepath.Glob in index-related ops
Feb 12, 2026
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
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.
Summary
MatchVersionedFileto search pre-scanned directory entries instead of per-filefilepath.GlobcallsDomain.OpenListto acceptScanDirsResultstruct instead of individual arraysCaplinSnapshots.OpenListnow usessnaptype.IdxFilesinstead ofos.ReadDirfor efficiencyMatchVersionedFilehandling seg/idx with different base names (blobsidecars.seg → blocksidecars.idx)SnapshotRepo.openDirtyFilesnow usesMatchVersionedFilewith pre-scanned entriesSome numbers
gnosis has large number of caplin/block files...offline commands/erigon startup had gotten slow because of
filepath.Globs..a
integration print_stagesbefore/after:In Future PRs
fileItemsWithMissedAccessorsindb/state/dirty_files.go:777- usesdir.FileExistper accessor, could use pre-scanned entries insteadFindFilesWithVersionsByPatterncan be fully replaced, move supported version check intoMatchVersionedFileopenFolder/openListin InvertedIndex/Domain/History acceptScanDirsResultdirectlyMatchVersionedFileBuildMissingIndicestoBuildMissedAccessorsin caplin/RoSnapshots for consistency with rest of codebaseIndex.HasFile,SnapType.FileExist,ParseFromFileindb/snaptype/type.godb/snaptype2/block_types.go