feat(executor): caller-owned deadline, lockers, and backend PID for concurrent builds - #76
feat(executor): caller-owned deadline, lockers, and backend PID for concurrent builds#76Kiran01bm wants to merge 1 commit into
Conversation
…oncurrent builds An orchestrator holding a concurrent index build under a renewable lease cannot express its bound as a fixed statement_timeout. Let ConcurrentBudget opt into caller-owned mode, where the cancellable context is the statement's only bound (a non-cancellable context is refused), expose the build backend PID through the progress tracker so the build can be cancelled from a second connection, and add lockers to the progress snapshot so a stalled build shows what it waits on.
382caea to
5209138
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
🤖 Adversarial correctness review, requested by Armand and performed by his agent. Reviewed at head Verdict: caller-owned mode is bounded by construction and the new refusals hold — but the mode's own primary exit path is the one thing not covered: a build cancelled by its caller can report
Findings1. In caller-owned mode every SQLSTATE 57014 becomes 2. 3. (test) Deleting the 4. (nit) The PR body says Action items
Verified (tried to break these, couldn't)Mutation results: deleting the This review was generated by Claude Code (claude-opus-5). |
|
🤖 Two-lens product review (adoption + integration), same head Lens 1 — OSS adoption easeThe best thing in this PR is a refusal message.
The Lens 2 — SchemaBot integrationThe seam is right to design now, because there is no consumer yet. SchemaBot's The version bump is correctly scoped and does not gate anything downstream. SchemaBot's strict-version gate is What integration will actually need next is a reason it can classify, not just an error it can wrap. Caller-owned mode exists for an orchestrator that renews a lease, and that orchestrator's decision tree is: my lease lapsed (retry later, same plan), an operator stopped it (do not retry, tell the human), the server killed it (retry with a different bound). Today the first two collapse into This review was generated by Claude Code (claude-opus-5). |
aparajon
left a comment
There was a problem hiding this comment.
🤖 Approving on Armand's behalf after the adversarial correctness review above. The findings there are yours to pick up as follow-ups — flagging them, not gating on them.
This stamp was left by Claude Code (claude-opus-5).
BuildIndexConcurrentlygains a caller-owned deadline mode, the progress tracker exposes the build backend's PID, and progress snapshots report the lockers a concurrent build is waiting on.Why
A concurrent index build on a large table can run for hours. Today the only bound the executor accepts is a fixed server-side
statement_timeout(ConcurrentBudget.Overall), which fits a synchronous attempt but not an orchestrator that keeps a build alive for as long as it can renew a lease. The same orchestrator needs to stop a running build from a second connection, which requires the build backend's PID, and its operators need to see why a build in the "waiting for old snapshots" phase is not moving, which requires the lockers columns ofpg_stat_progress_create_index.What
ConcurrentBudget.CallerOwned: the session runs withstatement_timeout = 0and the caller's cancellable context is the statement's only bound.Overallmust be zero, and a context that cannot be cancelled is refused withErrCallerOwnedNeedsCancellableContextbefore any session is acquired, so the statement remains bounded by construction (LK-2). In this mode SQLSTATE 57014 is alwaysErrCancelledExternally, never a*BudgetError. The bounded mode and every existing caller are unchanged.progress.Tracker.BuildPID()returns the active build's backend PID (0 when idle) forpg_cancel_backend.dbconn.ConcurrentIndexProgressreadslockers_total,lockers_done,current_locker_pid; the snapshot carries them aswork.lockers_total/work.lockers_doneanddetail.current_locker_pid.format_versionbumps to 2 anddocs/progress-report.mddocuments the new fields.docs/invariants.mdrecords the caller-owned exception; capability, execution-model and TCB docs no longer describestatement_timeoutas the only bound.tracker.BuildPID()returnsErrCancelledExternallywith its invalid leftover reported; a blocked build publisheslockers_total ≥ 1and the blocker's PID ascurrent_locker_pid.Before / after