Repository navigation
perf(runtime): commit runtime database writes in a pipelined persist fiber - #78
Merged
Merged
Conversation
…fiber Accepted batches, force-included mutations, and inclusion updates were committed inline, mostly under the speculative-state lock, so execution, submit, and watch waited on Postgres. One persist fiber now commits every runtime write. It groups everything that queued during the previous commit into one transaction, so batch N+1 executes while batch N commits. Inserts are queued under the lock right after executing, so they commit in execution order. Restart resumes after the highest committed execution index, so a later insert must not land before an earlier one. Callers of execute get a response only after their batch commits. Submit waits for the commits of the batches and force-included mutations it settles, outside the lock, before it broadcasts. The inclusion update is not awaited: nothing reads it, and the rows it updates are already committed. A failed commit stops the program, which fails waiting callers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Supersedes #61.
Summary
Accepted batches, force-included mutations, and inclusion updates were committed inline, mostly under the speculative-state lock, so execution,
submit, and watch waited on Postgres. One persist fiber now does every runtime database write.executefails fast on a rejection. An accepted mutation's caller then waits, outside any lock, for its own batch's commit.submitexecutes force-included mutations and queues their insert under the lock, then simulates. After the lock it waits for the commits of exactly the batches and force-included mutations it settles, then broadcasts. Nothing settles onchain before it is committed.TypewriterStoppedError.🤖 Generated with Claude Code