[8.8.0] Make naming scheme for repo contents cache entries more reliable#29073
Open
fmeum wants to merge 1 commit into
Open
[8.8.0] Make naming scheme for repo contents cache entries more reliable#29073fmeum wants to merge 1 commit into
fmeum wants to merge 1 commit into
Conversation
Use a UUID to name entries rather than a counter file. This has a number of advantages:
* It's simpler.
* Moving to the cache no longer requires exclusive locking on the predeclared inputs hash.
* Addresses potential repo staleness in case a counter ends up being reused after the contents cache has been removed. Consider the following situation:
- Repo foo is fetched for the first time and moved into the repo contents cache under <cache>/<hash>/1 since there is no `counter` file.
- The entire <cache> directory is deleted while the Bazel server is still alive.
- On the next invocation, Skyframe FS diffing notices that <cache>/<hash>/1 is missing and marks it as non-existent.
- Repo foo is refetched and moved into the repo contents cache under <cache>/<hash>/1 since there is again no `counter` file.
- The `FileStateValue` for that path continues to mark it as non-existent, which causes all Skyframe dependents to still consider it to be missing even after it has been restored.
Using a UUID prevents this since the refetched repo would symlink to a directory for which `FileStateFunction` hasn't been evaluated yet.
Work towards bazelbuild#26450
Closes bazelbuild#26683.
PiperOrigin-RevId: 819365781
Change-Id: I357246747632a36f190c8748f87511e3980bf2e4
(cherry picked from commit e66fe55)
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.
Make naming scheme for repo contents cache entries more reliable
Use a UUID to name entries rather than a counter file. This has a number of advantages:
- Repo foo is fetched for the first time and moved into the repo contents cache under
<cache>/<hash>/1since there is nocounterfile.- The entire
<cache>directory is deleted while the Bazel server is still alive.- On the next invocation, Skyframe FS diffing notices that
<cache>/<hash>/1is missing and marks it as non-existent.- Repo foo is refetched and moved into the repo contents cache under
<cache>/<hash>/1since there is again nocounterfile.- The
FileStateValuefor that path continues to mark it as non-existent, which causes all Skyframe dependents to still consider it to be missing even after it has been restored.Using a UUID prevents this since the refetched repo would symlink to a directory for which
FileStateFunctionhasn't been evaluated yet.Work towards #26450
Closes #26683.
PiperOrigin-RevId: 819365781
Change-Id: I357246747632a36f190c8748f87511e3980bf2e4
(cherry-picked from e66fe55)