Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Applications need to keep related queries, such as an INSERT and LAST_INSERT_ID(), on one session while limiting the number of open connections. Add qualified
MySQL.ConnectionPoolandMySQL.with_connectionfor scoped, exclusive use without another dependency or new exports.The limit includes connections being created, reset, or retired. Session cleanup drains unread responses, sends COM_RESET_CONNECTION, invalidates client statement/cursor generations, and restores the configured database, utf8mb4 and repeatable initializer. Callback failures retire the connection and preserve the original exception/backtrace; failed cleanup also retires it, and callbacks are never replayed. Closing the pool wakes waiters and rejects new leases while letting acquired leases finish. Network operations run outside the pool bookkeeping lock.
Connection ownership remains a caller contract: finish child work, statements and streaming results before returning. Owned buffered results survive. Escaped statements can still auto-reprepare; generation invalidation is not a revocable lease. With no configured database, a session that selected one is replaced because reset cannot clear that selection. Reset and initialization add network round trips; initializers must be repeatable. Unread SQL errors keep the driver's existing discard behavior.
Validation:
Hosted CI at
9fc59d2: all 15 checks pass, with two scheduled-only jobs skipped. The test waiter helper uses public condition notifications and passes current, minimum and nightly runtimes.Closes #140.
Co-authored by Codex