Skip to content

Preserve SQL pools on connection acquisition failure - #106

Merged
BenCodez merged 2 commits into
mainfrom
codex/connection-pool-borrow-safety
Oct 3, 2026
Merged

BenCodez merged 2 commits into
mainfrom
codex/connection-pool-borrow-safety

Conversation

@BenCodez

@BenCodez BenCodez commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

Problem

MCHT report 20261002T074536091320Z-b3672e3403c8 identified pool-pressure failures across MariaDB, MySQL, and PostgreSQL. The current acquisition handler returns null and opens a replacement pool without retiring its predecessor.

Change

  • Borrow failure leaves the existing pool intact and reports an explicit failure; no replacement is triggered by timeout/exhaustion.
  • Preserve the public no-checked-exception getConnection signature and its null-on-acquisition-failure contract. Internal SQL callers use the additive checked method.
  • Add getConnectionChecked for SQL callers and migrate internal Query/table acquisition to existing SQLException handling.
  • Serialize pool lifecycle publication/close, construct replacements before publishing, and retire predecessors after successful replacement, only through explicit internal replacement. The existing datasource setter remains assignment-only and does not close caller-supplied predecessor pools.
  • Release the lifecycle monitor before waiting for a connection lease; retain existing lazy initialization/reopening.

No configuration changes or database-format migration are required. SQL remains synchronous and belongs on storage workers. This does not change existing query retry/transaction contracts or claim SQL data loss in the original report.

Validation

  • Focused pool/shared-SQL tests: 12 passed, including all three database types, later borrow recovery, initialization/replacement failures, predecessor closure, checked/legacy API behavior, and deterministic blocked-borrow versus close concurrency.
  • Clean Maven package: 442 tests passed plus 2 full-artifact and 1 shared-artifact checks; no skips.
  • Whitespace check and fresh independent source review passed (No findings).
  • Actual Hikari construction/borrow behavior is mocked in unit tests; a new real-database MCHT pressure run has not been performed.

Release ordering

Publish SimpleAPI, then rebuild downstream shaded consumers (AdvancedCore, then VotingPlugin) so their JARs contain the fix. This PR is independent of the MariaDB fallback URL PR.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ec42e970-76e8-483a-ae03-a5a1653371ef
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-03T00:20:25.358976Z 31bb908 New commits
🔒 Security Review ✅ Completed 2026-10-02T23:28:50.053697Z 48db086 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@BenCodez

BenCodez commented Oct 3, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 48db08659e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@BenCodez
BenCodez merged commit fbec58c into main Oct 3, 2026
5 checks passed
@BenCodez
BenCodez deleted the codex/connection-pool-borrow-safety branch October 3, 2026 03:32
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