feat: expose fd cache - #181
Open
selmanozleyen wants to merge 1 commit into
Open
Conversation
zarrs_filesystem has had FilesystemStoreOptions::file_handle_cache_size since 0.3.11 (zarrs#422), but zarrs-python never forwarded it, so Python users cannot reach it: FilesystemStoreConfig::opts is private and only options with an explicit forwarding method are settable. Forward it as direct_io is already forwarded -- config key -> CodecPipelineImpl::new -> StoreConfig -> FilesystemStoreConfig -> opts, with the StoreConfig match no-opping for the HTTP and ObStore variants. Defaults to 0, the same default zarrs_filesystem applies. The upstream option is documented as invalidating on writes and erases through its own store, but not on external modification. The README notes what that means here specifically: zarr-python is itself such an external writer, because resize, delete_dir and metadata writes go through its own store rather than this pipeline's, so a cached handle can outlive the chunk file it refers to. The Zarr specification does not define behaviour for concurrent modification, so this is a property of the option rather than a defect; it is off by default. The test asserts the cache is actually engaged rather than only that reads are correct: reading a sharded array holds exactly file_handle_cache_size descriptors open, and none when disabled.
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.
Hi!
This file handler caching saves my life on some other performance optimization paths I am working on. So I think it makes sense that this is finally exposed.
zarrs_filesystemhasFilesystemStoreOptions::file_handle_cache_sizesince 0.3.11 (zarrs#422), but it is unreachable from Python:FilesystemStoreConfig::optsis private and only options with an explicit forwarding method can be set.The README notes the one zarr-python-specific caveat: the upstream option does not observe external modification.
One question — the code uses an API added in
zarrs_filesystem0.3.11, but the manifest is unchanged, sincezarrsrequires^0.3.9and resolution picks 0.3.12. That means-Z minimal-versionsfails. Happy to addzarrs_filesystem = "0.3.11"as a direct dependency if you would rather it were declared.