-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Bazel query silently thrashes the analysis cache #10902
Description
Description of the problem / feature request:
bazel query invalidates the analysis cache for subsequent builds, and neither the output of bazel build nor bazel query indicate the problem.
The best solution would be to call bazel query in a way that uses and preserves the current analysis cache. A secondary solution is to have one or both commands log about the problem.
bazel build does output a message to say that the analysis cache is being discarded – when build flags are changed. However bazel query is silently causing discarding the analysis cache, so we didn't know this was happening.
Chrome traces were showing over 10s of overhead at the start of each build, and we didn't know why. Removing our use of bazel query between builds solved this problem.
Feature requests: what underlying problem are you trying to solve with this feature?
Allow bazel query to reuse and preserve the analysis cache from the recent bazel build, if applicable.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
- Do a build
- Change a file
- Do the same build again
In the second build, the output should say:
INFO: Analyzed target //package:target (0 packages loaded, 0 targets configured).
Now, to see the bug:
- Do a build
- Do a bazel query
- Change a file
- Do the same build again
In the second build, the output will show that bazel has had to load >0 packages and configure >0 targets.
What operating system are you running Bazel on?
macOS
What's the output of bazel info release?
release 2.1.0