Repository navigation
Persist cluster WithTransaction failure replies after rollback - #8886
Merged
Merged
Conversation
…plies Regression coverage for persisted entity RPCs annotated with ClusterSchema.WithTransaction (#8883). Typed failures and non-fatal defects currently lose their persisted reply when the handler transaction rolls back; these cases fail until the fix lands.
RpcServer now sends failure responses after the onRequest wrapper exits, so a transaction it rolls back no longer discards the persisted reply. Success responses stay inside onRequest to keep them atomic with the handler's writes. Closes #8883
🦋 Changeset detectedLatest commit: e56fa7d The changes in this PR will be included in the next version bump. This PR includes changesets to release 32 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
Replace the platform-node SQLite suite with one Sharding test that simulates a rollback in memory storage and checks a retry receives the persisted failure without rerunning the handler.
Non-transactional requests bound to a remote caller must receive their failure reply before request-scope finalizers run, as on main. Fails on the current PR head, which defers failure replies for any onRequest.
…ager Move the failure-reply deferral from RpcServer's generic onRequest hook into the entity manager, which knows the request is transactional. RpcServer is back to main, so caller-bound requests without a transaction reply before their finalizers run again.
Contributor
|
👏 |
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.
Persisted entity RPCs annotated with
ClusterSchema.WithTransactionlost their failure reply.RpcServer.handleRequestwrote the reply in anEffect.onExitand then wrapped that withonRequest, which the entity manager sets tostorage.withTransaction. A failing handler rolled back its own reply and processed flag. The first caller still got the error in memory, but retries, deduplicated callers and other runners waited for a reply that was never committed, and restarts reran the handler.Change
The fix is in the entity manager, and
RpcServeris unchanged. While aWithTransactionrequest's transaction is open, the entity manager holds back a failureExitreply and saves it oncewithTransactionhas exited, after the rollback. Success replies are still saved inside the transaction, so they commit atomically with the handler's writes. Requests without a transaction, including caller-bound requests from other runners, keep their existing reply ordering.Resulting semantics for
WithTransactionentities:disableFatalDefectsDieexit persisted after rollbackTests
Sharding.test.ts, "WithTransaction persists a failure reply after rollback": memory storage is wrapped so that replies saved inside a failed transaction are cleared, the way a SQL rollback would discard them. A typed failure is retried with the same primary key and must return the stored failure without rerunning the handler. It times out without the fix.Not covered: a caller interrupting an in-flight transactional handler. On SQLite's single connection, the open transaction holds the connection, so the
Interruptenvelope can't be saved. That deadlock predates this PR and would need a pooled-database integration test.Closes #8883
Closes EFF-1820