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 an overwrite bit to UpdateActionResultRequest #314

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

bergsieker
Copy link
Collaborator

The existing UpdateActionResult allows for the server to return either the input ActionResult as the output, or return a pre-existing ActionResult from the cache. This bit allows the client to specify whether or not to overwrite an existing entry.

Comment on lines 1660 to 1665
// On a successful call, if a preexisting cache result already exists,
// the server MUST ignore the provided ActionResult and return the existing
// one instead. If a preexisting cache result does not exist, the server
// MUST write the provided ActionResult to the cache and use that
// ActionResult as the return value.
NOOVERWRITE = 2;
Copy link
Collaborator

Choose a reason for hiding this comment

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

How will the client be able to accurately tell whether the overwrite took place or not? Calling proto.Equal() or something may not be realistic, as there is no guarantee that a server does not modify/normalize/... ActionResults provided by the client.

Copy link
Contributor

Choose a reason for hiding this comment

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

This might require an API version bump.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Does the client need to know from a functional standpoint, or just from a performance one? Functionally, the client mostly cares that the set of output paths and digests match, and explicitly does not care about some fields like execution_metadata. (I'm actually not sure how we expect the client to handle things like stdout/stderr, but that's an existing sore spot in the API, not something specific to this change.) I can see the argument, though, that for performance reasons the client doesn't want to have to reprocess the whole output tree just to verify that things haven't changed.

If performance is the only concern, we could choose to break with the usual API semantics and specify that the server can return SUCCESS with an empty ActionResult if the provided ActionResult was written to the cache, so then the client only needs to compare the ActionResult if it's non-empty. That's clearly a larger change than I intended here (although we could also limit the impact by saying that this new semantic doesn't apply when the client uses UNSPECIFIED).

I'd also be open to creating a new API call, something like WriteActionResult, and deprecating UpdateActionResult. We had basically included UpdateActionResult in the API for completeness, but didn't really give much thought into how it works. Some of those gaps are more painfully obvious now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm absolutely fine with not providing a mechanism for informing the client whether an overwrite took place. But could we at least document this as part of the .proto?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I took another look at the existing comments, which are delightfully vague. I've updated this PR with what I hope works as a way to preserve the legacy behavior while providing a better path forward for clients and servers that support the new overwrite bit.

Obviously this will be a minor version bump.

@bergsieker bergsieker requested a review from tjgq October 16, 2024 15:59
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.

4 participants