Bazel should have a way to prefer the result from a remote cache over the one from local execution
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the feature request:
When using local execution with a remote cache, it's possible that the call to UpdateActionResult will return a different result than was provided as the input. For example, this could happen if two concurrent builds try to write the cache at once, and the cache chooses to accept the input from the other build. In such situations, it should be possible to get Bazel to accept the value from the remote cache and overwrite the local value. Preferring the remote value makes it more likely that downstream actions will get a remote cache hit.
It's my belief that this mode should eventually become the default mode for using a remote cache with local execution, but I'm willing to accept that it should be behind a flag for now. Preferring the remote result reduces cache fragmentation, and therefore likely improves performance both for the current build (by increasing the chances of downstream cache hits) and subsequent builds (due to reduced fragmentation).
### Which category does this issue belong to?
Remote Execution
### What underlying problem are you trying to solve with this feature?
Improving performance when using a remote cache with local execution.
### Which operating system are you running Bazel on?
_No response_
### What is the output of `bazel info release`?
_No response_
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse HEAD` ?
_No response_
### Have you found anything relevant by searching the web?
_No response_
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Research direction
The issue identifies remote-cache UpdateActionResult handling as the starting area, but names no files or tests. First locate that path in Bazel's remote-execution implementation, then determine how a flag could prefer the returned remote result over local execution; done means the behavior is covered by tests for concurrent or differing cache results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, distributed-systems, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100