GEOMESA-3583 Trino datastore: pool JDBC connections by unique authorization set#3586
Open
cwdobbins wants to merge 1 commit into
Open
GEOMESA-3583 Trino datastore: pool JDBC connections by unique authorization set#3586cwdobbins wants to merge 1 commit into
cwdobbins wants to merge 1 commit into
Conversation
…ed authorization set
cwdobbins
force-pushed
the
feature/trino-connection-pool
branch
from
July 16, 2026 18:00
21677ad to
317c672
Compare
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.
Trino datastore: pool JDBC connections keyed by authorization set
Closes #3583 (deferred from #3573).
Problem
The Trino datastore forwards each caller's authorizations to Trino as an
extraCredentialsentry that is fixed on the connection at creation — aconnection is its authorization context. The initial implementation therefore
opened a fresh connection per query, so deployments could never reuse
connections across requests, paying the connection setup cost on every query.
Approach
Connections are now pooled, keyed by the normalized authorization set
(sorted, deduped, validated): requests with the same effective auths reuse
connections; requests with different auths structurally cannot share one.
ConnectionPool— wraps a commons-pool2GenericKeyedObjectPool.PooledConnection— adbcp2 DelegatingConnectionsubclass whoseclose()returns the delegate to the pool exactly once; callers keepordinary try-with-resources semantics and no call sites changed. Any
other use after close throws, and
passivate()closes straggler statementsbefore the connection is re-lent.
encoding, so a pooled connection's credential always matches its key.
TrinoDataStore.dispose()drains the pool.New dependencies
commons-pool2andcommons-dbcp2- Deployments that stage this module'sJAR directly onto a classpath must stage these alongside it.