Registry Mirror
Skip to content

Conversation

@cloudonly

@cloudonly Luomu (cloudonly) commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Part of #3976.

Resume and suspend already read the Actor before updating its state. The store's UpdateActor now takes that revision and its replacement and issues one PostgreSQL UPDATE guarded by UID and version. If no row matches, it checks whether the Actor was deleted, recreated under the same name, or updated concurrently.

The public UpdateActor RPC checks the client's UID and version and preserves server-owned status and metadata when applying the replacement.

Validation on Linux for d37b05b3:

  • Built ateapi and ran the full atepg, controlapi, and functionaltest packages with -race -shuffle=on.
  • Ran the focused update, resume, and suspend tests three times with -race -shuffle=on. The PostgreSQL regression test observed a single UPDATE on success and checked stale versions, deletion, and same-name recreation.

AI use: AI-assisted, I reviewed and tested it.

@cloudonly
Luomu (cloudonly) marked this pull request as draft November 21, 2026 07:19
@cloudonly
Luomu (cloudonly) marked this pull request as ready for review November 21, 2026 09:05
@juli4n

Copy link
Copy Markdown
Collaborator

I would rather not add a parallel UpdateObservedActor method to store.Interface (and ServiceImpl).

The mutate callback and the extra SELECT in UpdateActor are leftovers from when we had patch semantics and store-side retries. Every Update<Resource> now requires both uid and version preconditions and does whole-resource replacement with optimistic locking, so atepg does not need a mutate callback or a pre-UPDATE read at all.

Instead of adding a second method, could we change UpdateActor itself to take the replacement *ateapi.Actor directly? Workflows (like ResumeActor/ResumeActor) will benefit from this as they won't be doing one extra read per update.

Resume and suspend already read the Actor before setting it to
RUNNING or SUSPENDING. Reuse that copy for the UID- and version-guarded
update to save a PostgreSQL round trip.

Signed-off-by: Luomu <enrondg@gmail.com>
@cloudonly
Luomu (cloudonly) force-pushed the perf/3976-avoid-actor-reread branch from f465ea0 to 87f2a25 Compare December 2, 2026 10:01
Signed-off-by: cloudonly <enrondg@gmail.com>
@cloudonly

Copy link
Copy Markdown
Contributor Author

Agreed, thanks for the suggestion. In d37b05b I removed UpdateObservedActor and changed UpdateActor to take the replacement directly, eliminating the callback and the extra SELECT on successful writes.

This branch has not been deployed

No deployments
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.

2 participants