Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary synchronization on RepositoryCache #21403

Closed
wants to merge 1 commit into from

Conversation

fmeum
Copy link
Collaborator

@fmeum fmeum commented Feb 18, 2024

With a single exception that didn't matter for correctness, the operations on RepositoryCache were already atomic on the level of the file system and thus don't require synchronized. In fact, since different Bazel server instances share the same repository cache concurrently, this already had to be the case.

The exception was a file write that stores the canonical id in a file whose name contains a hash of the id. However, the content of this file is never read, only its existence matters. The write is replaced by a touch.

Also removes unnecessary interrupt checks and method overloads only used in tests.

Work towards #20369

With a single exception that didn't matter for correctness, the
operations on `RepositoryCache` were already atomic on the level of the
file system and thus don't require `synchronized`. In fact, since
different Bazel server instances share the same repository cache
concurrently, this already had to be the case.

Also removes unnecessary interrupt checks and method overloads only used
in tests.
@fmeum fmeum requested a review from Wyverald February 18, 2024 18:23
@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 Feb 18, 2024
@fmeum
Copy link
Collaborator Author

fmeum commented Mar 8, 2024

@Wyverald Friendly ping in case you forgot about it, no-op ping in case you are busy :-)

@Wyverald
Copy link
Member

Wyverald commented Mar 8, 2024

@Wyverald Friendly ping in case you forgot about it, no-op ping in case you are busy :-)

sorry about the delay, I had indeed forgotten. The PR overall LGTM, just asked for a small clarification.

@fmeum fmeum requested a review from Wyverald March 8, 2024 22:11
@Wyverald Wyverald added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Mar 8, 2024
@fmeum
Copy link
Collaborator Author

fmeum commented Mar 8, 2024

@bazel-io fork 7.2.0

@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Mar 11, 2024
@fmeum fmeum deleted the 20369-repo-cache-synchro branch March 12, 2024 20:55
bazel-io pushed a commit to bazel-io/bazel that referenced this pull request Mar 25, 2024
With a single exception that didn't matter for correctness, the operations on `RepositoryCache` were already atomic on the level of the file system and thus don't require `synchronized`. In fact, since different Bazel server instances share the same repository cache concurrently, this already had to be the case.

The exception was a file write that stores the canonical id in a file whose name contains a hash of the id. However, the content of this file is never read, only its existence matters. The write is replaced by a touch.

Also removes unnecessary interrupt checks and method overloads only used in tests.

Work towards bazelbuild#20369

Closes bazelbuild#21403.

PiperOrigin-RevId: 614728666
Change-Id: I67f81bd9e468260e4f83f15d6aaafa57e34d18f4
iancha1992 pushed a commit that referenced this pull request Mar 28, 2024
With a single exception that didn't matter for correctness, the
operations on `RepositoryCache` were already atomic on the level of the
file system and thus don't require `synchronized`. In fact, since
different Bazel server instances share the same repository cache
concurrently, this already had to be the case.

The exception was a file write that stores the canonical id in a file
whose name contains a hash of the id. However, the content of this file
is never read, only its existence matters. The write is replaced by a
touch.

Also removes unnecessary interrupt checks and method overloads only used
in tests.

Work towards #20369

Closes #21403.

PiperOrigin-RevId: 614728666
Change-Id: I67f81bd9e468260e4f83f15d6aaafa57e34d18f4

Commit
8eade04

Co-authored-by: Fabian Meumertzheim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants