Skip to content

[9.1.0] Avoid copying on disk cache hits if supported by the file system (htt…#28940

Merged
iancha1992 merged 1 commit intobazelbuild:release-9.1.0from
iancha1992:cp28386
Mar 13, 2026
Merged

[9.1.0] Avoid copying on disk cache hits if supported by the file system (htt…#28940
iancha1992 merged 1 commit intobazelbuild:release-9.1.0from
iancha1992:cp28386

Conversation

@iancha1992
Copy link
Copy Markdown
Member

…ps://github.com//pull/28369)

RELNOTES: Bazel no longer verifies the digests of disk cache entries upon a cache hit. This honors the description but not the previous behavior of the --remote_verify_downloads flag, which in fact controlled digest verification for both remote and disk caches.

In the process, LazyFileOutputStream#flush had to be changed to not open the stream if not open yet, otherwise it would override the existing contents.

Tested manually by running a fully cached build of //src:bazel and then verifying that du -kh bazel-bin/src/bazel prints 0B on macOS.

Closes #28369.

PiperOrigin-RevId: 881397852
Change-Id: Icf3535ff31e314605c6003bd48602f6e00317022

Description

Motivation

Build API Changes

No

Checklist

  • I have added tests for the new use cases (if any).
  • I have updated the documentation (if applicable).

Release Notes

RELNOTES: None

Commit 7666e2a

…elbuild#28369)

RELNOTES: Bazel no longer verifies the digests of disk cache entries upon a cache hit. This honors the description but not the previous behavior of the `--remote_verify_downloads` flag, which in fact controlled digest verification for both remote and disk caches.

In the process, `LazyFileOutputStream#flush` had to be changed to not open the stream if not open yet, otherwise it would override the existing contents.

Tested manually by running a fully cached build of `//src:bazel` and then verifying that `du -kh bazel-bin/src/bazel` prints `0B` on macOS.

Closes bazelbuild#28369.

PiperOrigin-RevId: 881397852
Change-Id: Icf3535ff31e314605c6003bd48602f6e00317022
@iancha1992 iancha1992 requested a review from tjgq March 10, 2026 19:06
@iancha1992 iancha1992 requested a review from a team as a code owner March 10, 2026 19:06
@iancha1992 iancha1992 added team-Remote-Exec Issues and PRs for the Execution (Remote) team awaiting-review PR is awaiting review from an assigned reviewer labels Mar 10, 2026
@iancha1992 iancha1992 enabled auto-merge March 10, 2026 19:06
FileSystemUtils.copyFile(path, outPath);
} else {
try (InputStream in = path.getInputStream()) {
in.transferTo(out);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In 7666e2a, it's supposed to be
try (InputStream in = path.getInputStream()) { ByteStreams.copy(in, out); }
Is this okay?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in.transferTo is pretty much strictly better, not sure why I used ByteStream in the initial PR

@iancha1992 iancha1992 added this pull request to the merge queue Mar 13, 2026
Merged via the queue into bazelbuild:release-9.1.0 with commit fd792c0 Mar 13, 2026
46 checks passed
@github-actions github-actions Bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-Remote-Exec Issues and PRs for the Execution (Remote) team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants