bazel icon indicating copy to clipboard operation
bazel copied to clipboard

Store remote registry file hashes in the lockfile

Open fmeum opened this issue 1 year ago • 9 comments

MODULE.bazel, bazel_registry.json and source.json files obtained from remote registries are stored in the repository cache and their hashes are collected in the lockfile. This speeds up incremental module resolutions, such as after adding a new bazel_dep.

Yanked versions are not stored in the lockfile. Their handling will be part of a follow-up PR.

Implements part of https://docs.google.com/document/d/1TjA7-M5njkI1F38IC0pm305S9EOmxcUwaCIvaSmansg/edit Work towards #20369

fmeum avatar Apr 04 '24 18:04 fmeum

Currently stacked on #21906, but otherwise ready for review.

fmeum avatar Apr 05 '24 16:04 fmeum

This is no longer stacked and ready for review again.

fmeum avatar Apr 17 '24 11:04 fmeum

This is stacked on #22058, please only consider the last commit.

fmeum avatar Apr 25 '24 13:04 fmeum

No longer stacked.

fmeum avatar Apr 26 '24 09:04 fmeum

@fmeum You sent me a private message last week I think related to this change but now I can't find it, I believe due to default chat retention. Please try re-sending or asking on a more durable medium (like here).

justinhorvitz avatar Apr 29 '24 21:04 justinhorvitz

@justinhorvitz It's related to a follow-up PR I haven't sent out yet, but it does make sense to ask it here:

While continuing my work to get rid of Bzlmod events retained by Skyframe, I noticed that certain Bazel commands don't cause Skyframe to invalidate its "done" nodes. For example, in the afterCommand of a bazel shutdown invocation, I still see "done" Skyframe nodes that depend on invalidated values (say changed flag values injected as precomputed values).

Is there a way to reliably detect such commands so that I can skip all work for them?

fmeum avatar Apr 29 '24 21:04 fmeum

@justinhorvitz It's related to a follow-up PR I haven't sent out yet, but it does make sense to ask it here:

While continuing my work to get rid of Bzlmod events retained by Skyframe, I noticed that certain Bazel commands don't cause Skyframe to invalidate its "done" nodes. For example, in the afterCommand of a bazel shutdown invocation, I still see "done" Skyframe nodes that depend on invalidated values (say changed flag values injected as precomputed values). Is there a way to reliably detect such commands so that I can skip all work for them?

I don't know of a perfect way short of listening for MemoizingEvaluator#evaluate calls. But perhaps an acceptable proxy is to check Command#mustRunInWorkspace - I think that should return false for a bunch of commands that you don't care about.

justinhorvitz avatar Apr 29 '24 21:04 justinhorvitz

@fmeum can you please add the Javadoc comment for KnownFileHashesMode from src/main/java/com/google/devtools/build/lib/bazel/bzlmod/IndexRegistry.java? Thanks!

iancha1992 avatar May 02 '24 23:05 iancha1992

@fmeum can you please add the Javadoc comment for KnownFileHashesMode from src/main/java/com/google/devtools/build/lib/bazel/bzlmod/IndexRegistry.java? Thanks!

Done!

fmeum avatar May 03 '24 06:05 fmeum

quick update -- running into some internal test failures during import; will probably submit today or tomorrow

Wyverald avatar May 06 '24 20:05 Wyverald

For future reference:

  1. Anything contained in a SkyValue needs to implement equals() and hashCode() (Checksum did not)
  2. Our internal serialization framework doesn't support records (yet?), so we have to use AutoValue for now.

No need to make any changes -- this is just informational

Wyverald avatar May 06 '24 21:05 Wyverald

@bazel-io fork 7.2.0

fmeum avatar May 07 '24 13:05 fmeum

The changes in this PR have been included in Bazel 7.2.0 RC1. Please test out the release candidate and report any issues as soon as possible. If you're using Bazelisk, you can point to the latest RC by setting USE_BAZEL_VERSION=7.2.0rc1. Thanks!

iancha1992 avatar May 15 '24 23:05 iancha1992