Repository navigation
ateapi: accept optional preconditions on custom methods - #4046
Open
haiyanmeng wants to merge 1 commit into
Open
haiyanmeng wants to merge 1 commit into
haiyanmeng wants to merge 1 commit into
Conversation
haiyanmeng
force-pushed
the
custom-method-preconditions
branch
2 times, most recently
from
November 20, 2026 23:00
bf23cc8 to
ea25959
Compare
SuspendActor, ResumeActor, RevertActor, DrainWorker, MarkWorkerAvailable and MarkWorkerUnavailable act on whichever resource holds the name when the call arrives. A client that read the resource earlier can act on a different one if the name was deleted and recreated in between. Add a Preconditions message with the same optional uid and version guards as DeleteOptions, and accept it on each of these requests. The server checks it against the resource it loads and returns ABORTED on a mismatch. Suspend checks before returning an already suspended actor, so a stale call cannot report success for a different actor. RequestActorSuspend sends the uid and version of the actor it checked as preconditions. The workflow then refuses an actor that was recreated, or resumed onto another worker, after the check. The worker still gets NotFound for an actor it no longer hosts. ResumeActor no longer retries a worker assignment against an actor recreated after the failed bind. Its template and guards were checked against the old one. Under a version guard, it also aborts when the actor changes during worker assignment or node detach, instead of retrying on the newer version. actorWriteError now reports a uid conflict apart from a version conflict. Suspend, Resume and Revert and their workflow steps use it, so a uid conflict returns ABORTED instead of INTERNAL, in both the RPC status and the lifecycle metric. Signed-off-by: Haiyan Meng <haiyanmeng@google.com>
haiyanmeng
force-pushed
the
custom-method-preconditions
branch
from
November 20, 2026 23:03
ea25959 to
cc0fe5b
Compare
Collaborator
|
Can we scope this PR down to actor lifecycle methods? |
Julian Gutierrez Oschmann (juli4n)
self-requested a review
November 20, 2026 23:23
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SuspendActor,ResumeActor,RevertActor,DrainWorker,MarkWorkerAvailableandMarkWorkerUnavailableact on whichever resource holds the name when the call arrives. A client that read the resource earlier can act on a different one if the name was deleted and recreated in between.Each of these requests now accepts an optional
Preconditionsmessage, with the sameuidandversionguards asDeleteOptions. A guard that does not match returnsABORTED. An unset guard is not checked, so existing clients see no change.RequestActorSuspendnow sends the uid and version of the actor it checked. The workflow refuses the actor if it was resumed onto another worker, or deleted and recreated, before the workflow took the lease. On thatABORTED, the worker getsNotFoundif it no longer hosts the actor, and retries otherwise.ABORTEDinstead ofINTERNAL.Version skew:
preconditionsis a new optional field. An olderate-api-serverrejects a request that sets it withINVALID_ARGUMENT, so clients must not set it until every replica runs this version. Requests that leave it unset work on both versions.MintActorJwtis the only other custom method onControl. It doesn't change the actor, so it takes no guards.Addresses #1773
AI use: I used Claude Code to review the diff, rebase onto main, and draft the commit message and this description. I reviewed all of it.