Skip to content

fix: Bound PostgreSQL schema inspection and observe sibling errors - #6046

Open
jjprusk wants to merge 1 commit into
serverpod:mainfrom
jjprusk:fix/postgres-analyzer-bounded-concurrency
Open

jjprusk wants to merge 1 commit into
serverpod:mainfrom
jjprusk:fix/postgres-analyzer-bounded-concurrency

Conversation

@jjprusk

@jjprusk jjprusk commented Nov 24, 2026 •

Copy link
Copy Markdown

Fixes #6045

PostgreSQL startup integrity checks currently start three metadata queries per table for the entire schema at once. Pending work grows with schema size. Separately awaiting each table’s futures can also leave foreign-key/index errors unhandled after a columns failure.

Use three table workers and one Future.wait for each table’s metadata. Keep definitions in catalog order, wait for work already started, and stop scheduling more tables after a worker observes failure. This caps metadata requests at nine and adds no public API or dependency.

Add a standalone regression suite that exercises the real analyzer orchestration with controlled metadata futures, including large/empty/small schemas, out-of-order completion, schema names, metadata preservation, multiple asynchronous failures, and settlement of in-flight work.

Validation

  • Unmodified upstream main: 6 regression cases pass, 3 fail as expected.
  • Patched source: all 9 regression cases pass.
  • Adjacent existing schema tests: all 27 pass.
  • Focused static analysis: no issues.
  • Formatting: checked with Dart 3.12.2.
  • Host: macOS arm64.

Validation used an isolated copy of the database package, removing only resolution: workspace in the validation harness and resolving published sibling packages at 4.1.2. The submitted patch leaves workspace/dependency metadata unchanged. Full monorepo CI and live PostgreSQL tests were not run locally; upstream CI runs separately on this PR.

The fixed width is deliberately conservative; it does not guarantee success if all available connections remain blocked or queries themselves exceed acquisition deadlines. Maintainer feedback on the concurrency policy is welcome.

Related report: #4645 (matching symptoms, not a claimed proven root cause).

Prepared with AI assistance. Personally reviewed by Joe Prusk (@jjprusk), who confirmed completion of his review. Upstream CI status is tracked by the PR checks.

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@jjprusk

jjprusk commented Nov 24, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

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.

PostgreSQL schema analyzer queues unbounded metadata work and leaves sibling errors unhandled

1 participant