Skip to content

[8.8.0] Make naming scheme for repo contents cache entries more reliable#29073

Open
fmeum wants to merge 1 commit into
bazelbuild:release-8.8.0from
fmeum:rrcc-8.7.0-07
Open

[8.8.0] Make naming scheme for repo contents cache entries more reliable#29073
fmeum wants to merge 1 commit into
bazelbuild:release-8.8.0from
fmeum:rrcc-8.7.0-07

Conversation

@fmeum
Copy link
Copy Markdown
Collaborator

@fmeum fmeum commented Mar 24, 2026

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:

  • 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 #26450

Closes #26683.

PiperOrigin-RevId: 819365781
Change-Id: I357246747632a36f190c8748f87511e3980bf2e4
(cherry-picked from e66fe55)

@iancha1992 iancha1992 added this to the 8.7.0 release blockers milestone Mar 27, 2026
@iancha1992 iancha1992 added the soft-release-blocker Soft release blockers that are nice to have, but shouldn't block the release if it's the last one. label Apr 24, 2026
@iancha1992 iancha1992 changed the title [8.7.0] 07/23: Make naming scheme for repo contents cache entries more reliable [8.8.0] 07/23: Make naming scheme for repo contents cache entries more reliable May 7, 2026
@iancha1992 iancha1992 changed the base branch from release-8.7.0 to release-8.8.0 May 7, 2026 18:01
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)
@fmeum fmeum changed the title [8.8.0] 07/23: Make naming scheme for repo contents cache entries more reliable [8.8.0] Make naming scheme for repo contents cache entries more reliable May 23, 2026
@fmeum fmeum marked this pull request as ready for review May 23, 2026 17:32
@fmeum fmeum requested a review from a team as a code owner May 23, 2026 17:32
@fmeum fmeum requested a review from Wyverald May 23, 2026 17:32
@github-actions github-actions Bot added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. awaiting-review PR is awaiting review from an assigned reviewer labels May 23, 2026
@iancha1992 iancha1992 enabled auto-merge May 26, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review PR is awaiting review from an assigned reviewer soft-release-blocker Soft release blockers that are nice to have, but shouldn't block the release if it's the last one. team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants