Skip to content

Relax worker session operation admission#750

Closed
bill-ph wants to merge 4 commits into
mainfrom
codex/relax-worker-session-operation-gate
Closed

Relax worker session operation admission#750
bill-ph wants to merge 4 commits into
mainfrom
codex/relax-worker-session-operation-gate

Conversation

@bill-ph

@bill-ph bill-ph commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

This changes the worker session operation model from hard admission control to safety-by-convention at the protocol layer. Pgwire clients do not have a happy-path way to run concurrent user queries on a single connection, but the control plane can still produce brief worker Flight RPC overlap during normal serial flows, especially Describe/GetFlightInfo cleanup followed by Execute. Treating that overlap as an active user operation caused false FailedPrecondition failures.

The worker now keeps the mechanical safety where it matters: connMu serializes actual sql.Conn / sql.Tx access, connWork fences teardown and reapers, and drain tokens still track pending continuations for graceful shutdown. Pending Flight continuations no longer make the session globally busy.

Changes

  • Remove the operationOpen session admission flag and make operation helpers only reject closed sessions.
  • Change the old busy error path to report session closed instead of session already has an active operation.
  • Update worker tests to allow pending GetFlightInfo/DoGet continuations for statements and metadata while preserving drain cleanup assertions.
  • Update COPY and reaper tests to rely on connection/drain guards instead of the old admission gate.
  • Update the e2e harness README to document why same-session Flight overlap is unit-covered rather than asserted in the in-cluster pgwire harness.

Verification

  • Red: go test ./duckdbservice -run "TestStatementFlightInfo.*AllowsNextQueryBeforePriorDoGet" -count=1 failed before the implementation change with session already has an active operation.
  • Green: go test ./duckdbservice -count=1
  • Green: just test-unit
  • Green: git diff --check
  • Green: just lint

@bill-ph bill-ph closed this Jun 10, 2026
@bill-ph bill-ph deleted the codex/relax-worker-session-operation-gate branch June 10, 2026 19:36
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.

1 participant