Skip to content

Use the DefaultConnectionPool for the SQL connection pool - #1820

Merged
vietj merged 3 commits into
masterfrom
use-default-connection-pool
Dec 2, 2026
Merged

vietj merged 3 commits into
masterfrom
use-default-connection-pool

Conversation

@vietj

@vietj vietj commented Dec 1, 2026

Copy link
Copy Markdown
Member

Motivation:

Adopt the new Vert.x connection pool implementation
(eclipse-vertx/vert.x#6587) that will provide more features, one of them
is getting away from a timer per acquisition since the pool owns the
acquisition lifecycle (#1807, #1342).

Changes:

The pool checks staleness, closes the connections it evicts and times
out acquisitions with a TimeoutException. As a side effect this fixes
the bug addressed by #1807: a timed out query no longer keeps its slot
in the wait queue, asserted by a test ported from that PR. A periodic
refresh, configured by the new pool refresh period option (100 ms
default), drives all the maintenance tasks; the pool cleaner period is
deprecated. The queue metric only accounts acquisitions that effectively
wait.

Assisted-by: Anthropic Claude (claude-fable-5)
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Signed-off-by: Julien Viet julien@julienviet.com

@vietj vietj added this to the 5.3.0 milestone Dec 1, 2026
@vietj
vietj force-pushed the use-default-connection-pool branch from 4fd25a6 to af947f1 Compare December 1, 2026 17:43
@vietj

vietj commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

cc @tsegismont

Motivation:

Adopt the new Vert.x connection pool implementation
(eclipse-vertx/vert.x#6587) that will provide more features, one of them
is getting away from a timer per acquisition since the pool owns the
acquisition lifecycle (#1807, #1342).

Changes:

The pool checks staleness with the connection checker configured in the
builder, closes the connections it evicts and times out acquisitions
with a TimeoutException. As a side effect this fixes the bug addressed
by #1807: a timed out query no longer keeps its slot in the wait queue,
asserted by a test ported from that PR. A mandatory periodic refresh,
configured by the new refresh period option (a Duration of at least one
millisecond, 100 ms by default), drives all the maintenance tasks; the
pool cleaner period is deprecated. The queue metric only accounts
acquisitions that effectively wait.

Assisted-by: Anthropic Claude (claude-fable-5)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Julien Viet <julien@julienviet.com>

@tsegismont tsegismont left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks @vietj

It simplifies the CommandScheduler and opens the door to new features 👏

One thing not carried over from #1807 is extracting common code between the acquisition and execution paths. Would be great to have it here. The rationale for this was avoiding new bugs fixed on one path but not the other.

@vietj

vietj commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

thanks @tsegismont for the review I'll address the points and get back

vietj and others added 2 commits December 2, 2026 13:51
Note that the default refresh period is small enough for any meaningful
connection timeout, and remove the pool metrics section: the metrics a
component reports belong to the metrics project documentation.

Assisted-by: Anthropic Claude (claude-fable-5)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Julien Viet <julien@julienviet.com>
Extract the common code of the pooled query and connection acquisition
paths into a PoolRequest: the pool waiter listener and the completable
handed over to the pool, accounting the queue metric and reporting the
acquisition timeout, so a fix on one path cannot be missed on the other.
ExecuteRequest and AcquireRequest implement the outcome of each path in
their own file.

Assisted-by: Anthropic Claude (claude-fable-5)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Julien Viet <julien@julienviet.com>
@vietj

vietj commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

feedback addressed @tsegismont

@tsegismont tsegismont left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@vietj Great, ship it!

@vietj
vietj merged commit ea1b52d into master Dec 2, 2026
20 checks passed
@vietj
vietj deleted the use-default-connection-pool branch December 2, 2026 19:44
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.

2 participants