Skip to content

Diagnose relay PostgreSQL failures by acquisition versus execution phase - #20749

Merged
Jinwoo-H merged 1 commit into
mainfrom
fix/relay-query-failure-phase
Sep 15, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
fix/relay-query-failure-phase

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​179 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​179
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​100 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​98

Relay renewal failures currently collapse connection acquisition failures and server SQL failures into the same outcome. Emit a bounded orca_relay_postgres_query_failed event identifying acquire/execute phase, allowlisted error code, renewal/other operation, elapsed time, and pool counts. Preserve the original error, connection release, deadlines, and retry behavior. No query text, parameters, error messages, credentials, or identifiers are logged.

Coverage is the autocommit query path, including the control-renewal CTE; explicit transaction statements retain their existing diagnostics. This is observation for the ongoing production contention investigation, not a claim that the failures are fixed. The documented rollout is one cell through the owning same-cap workflow, with an immutable predecessor for rollback and no schema/settings change.

Validation: full relay suite against isolated PostgreSQL 16 passed (723 tests, one skipped); typecheck passed. Nine focused tests cover real pool starvation and statement cancellation, pool reuse, original error identity, client release, successful-query silence, and sensitive-field exclusion. The diagnostic regression tests fail on the unchanged implementation (five failures).

@pullfrog

pullfrog Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

This run was cancelled 🛑

The workflow was cancelled before completion. Please check the link below for details.

Pullfrog  | View workflow run | via Pullfrog | 𝕏

@Jinwoo-H
Jinwoo-H merged commit b07c403 into main Sep 15, 2026
25 of 26 checks passed
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: ea514dfa-4d57-4db5-aa93-cf0131cb85fe

📥 Commits

Reviewing files that changed from the base of the PR and between 4bcdc67 and 278ba80.

📒 Files selected for processing (5)
  • cloud/apps/relay/src/database.ts
  • cloud/apps/relay/src/postgres-query-failure-postgres.test.ts
  • cloud/apps/relay/src/postgres-query-failure.test.ts
  • cloud/apps/relay/src/postgres-query-failure.ts
  • cloud/docs/relay-database-failure-diagnostics.md

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The change adds sanitized PostgreSQL failure diagnostics for connection acquisition and query execution. PostgresDatabase.query records the phase and elapsed time, reports failures, and safely releases clients. The reporter allowlists error codes and omits SQL, parameters, messages, and identifiers. Unit and PostgreSQL integration tests cover timeout, acquisition, execution, redaction, logger failures, and pool reuse. Documentation defines the event fields and observation procedure.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 278ba

The new diagnostics correctly classify control-renewal failures and no merge-blocking issue remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change, rationale, scope, testing, security limits, and rollout plan, but it omits most required template sections. The Linked Issue is blank, and Visual Proof, Review, No… Complete the required template sections. Add the linked issue after “Fixes #”, add “N/A” with a reason under Visual Proof because this is not a UI change, document review and cross-platform considerations, complete the Agent skill upstream …
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 4 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: distinguishing relay PostgreSQL failures by acquisition and execution phase.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the change, rationale, scope, testing, security limits, and rollout plan, but it omits most required template sections. The Linked Issue is blank, and Visual Proof, Review, Notes, Agent skill upstream boundary, and Checklist sections are missing.

Resolution

Complete the required template sections. Add the linked issue after “Fixes #”, add “N/A” with a reason under Visual Proof because this is not a UI change, document review and cross-platform considerations, complete the Agent skill upstream boundary and Checklist items, and include AI disclosure details if applicable.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 4 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Jinwoo-H added a commit that referenced this pull request Sep 16, 2026
Snapshot of the uncommitted working tree so nothing is lost when the worktree is
removed. Superseded by main: the region-correction feature landed via #20105,
#20712, #20749, and the pool-canary gate it was blocking on was retired after
the contention was traced to the fleet-wide cell-inventory lock (#21067).
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