Repository navigation
[HfFileSystem] Make refresh=True clear cached not-found results - #5106
Merged
Merged
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Contributor
|
This PR has been shipped as part of the v2.2.0 release. |
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.
Summary
HfFileSystemcaches "not found" for repos, revisions and buckets, andexists(path, refresh=True)/invalidate_cache(path)couldn't clear it:invalidate_cacheresolves the path first, which re-raises the cached miss. Aftercreate_repo,create_branchorcreate_bucketin the same process, the target stayed missing until a fullinvalidate_cache()(buckets: not even that).invalidate_cache(path)now drops cached misses when the path doesn't resolve, sorefresh=Trueworks after creation like it already does after deletion (FixHfFileSystem.exists()for deleted repos and update documentation #2643).invalidate_cache()with no path now also clears the bucket cache.repo_infoper instance.Same for
repo_id@devaftercreate_branchandbuckets/...aftercreate_bucket(checked on hub-ci).Alternative to #5089, which stops caching missing repos. That fixes
exists()withoutrefresh=True, but it leaves branches and buckets stale and sends a newrepo_infoon every call for a missing repo. Writes made throughHfApistill needrefresh=True, the same as files uploaded withupload_file.Fixes #1945.
Note
Low Risk
Targeted cache-layer fix in HfFileSystem with a regression test; behavior change is limited to refresh/invalidate paths that previously failed silently.
Overview
HfFileSystemcache invalidation now works when a path was previously cached as missing.invalidate_cache(path)used to callresolve_pathfirst, which re-threw the cached not-found and blockedexists(..., refresh=True)after in-processcreate_repo,create_branch, orcreate_bucket.On
FileNotFoundErrorduring path invalidation, the implementation drops cached misses from_repo_and_revision_exists_cacheand_bucket_exists_cacheso the next lookup hits the Hub. A fullinvalidate_cache()with no path also clears_bucket_exists_cache.A regression test covers
exists(repo_id, refresh=True)flipping to true after the repo is created (#1945).Reviewed by Cursor Bugbot for commit 62aab27. Bugbot is set up for automated code reviews on this repo. Configure here.