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

add option to mangle AC keys with (non-empty) instance names #339

Merged
merged 1 commit into from
Aug 28, 2020

Conversation

mostynb
Copy link
Collaborator

@mostynb mostynb commented Aug 25, 2020

In some client setups, untracked local files can be used by an action without being included in the Action message, which causes action cache collisions: bazelbuild/bazel#4558

Ideally this should be fixed on the client side (either in the client, or in the build configuration), but it is not always easy to do in practice.

As a workaround, this patch adds a setting to mangle ActionCache keys with the instance name provided by the client (if it is not empty), to produce a new ActionCache key. Clients are then able to specify a different instance name whenever a change is made that could affect these untracked inputs. The instance name value could be something like the hash of the compiler version. This allows multiple ActionCache items to exist in the cache, without requiring a change to the on-disk storage format.

This feature is disabled by default, since it would cause cache invalidations for existing users.

Fixes #15.

In some client setups, untracked local files can be used by an action
without being included in the Action message, which causes action cache
collisions: bazelbuild/bazel#4558

Ideally this should be fixed on the client side (either in the client,
or in the build configuration), but it is not always easy to do in
practice.

As a workaround, this patch adds a setting to mangle ActionCache keys
with the instance name provided by the client (if it is not empty), to
produce a new ActionCache key. Clients are then able to specify a
different instance name whenever a change is made that could affect
these untracked inputs. The instance name value could be something like
the hash of the compiler version. This allows multiple ActionCache items
to exist in the cache, without requiring a change to the on-disk storage
format.

This feature is disabled by default, since it would cause cache
invalidations for existing users.

Fixes buchgr#15.
@kragniz
Copy link
Contributor

kragniz commented Aug 25, 2020

From a brief read, this looks great! I'll exercise it locally over the next day or two.

Copy link
Contributor

@kragniz kragniz left a comment

Choose a reason for hiding this comment

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

This has been running in a dev environment without problems

@mostynb mostynb merged commit 7c4b968 into buchgr:master Aug 28, 2020
@mostynb mostynb deleted the ac_key_instance_mangling branch August 28, 2020 16:27
amartani added a commit to amartani/bazel-remote that referenced this pull request Oct 21, 2022
buchgr#339 implemented AC key mangling based on instance name. However, that implementation missed applying the mangling logic on grpc UpdateActionResult method, causing cached entries to not match the ones fetched by GetActionResult. Correctly implement the feature on that method and add test to verify the new behavior.
amartani added a commit to amartani/bazel-remote that referenced this pull request Oct 21, 2022
buchgr#339 implemented AC key mangling based on instance name. However, that implementation missed applying the mangling logic on grpc UpdateActionResult method, causing cached entries to not match the ones fetched by GetActionResult. Correctly implement the feature on that method and add test to verify the new behavior.
amartani added a commit to amartani/bazel-remote that referenced this pull request Oct 21, 2022
buchgr#339 implemented AC key mangling based on instance name. However, that implementation missed applying the mangling logic on grpc UpdateActionResult method, causing cached entries to not match the ones fetched by GetActionResult. Correctly implement the feature on that method and add test to verify the new behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow per project cache
2 participants