Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider extending ConnectionFactory with create(ConnectionDefinition) #167

Open
mp911de opened this issue Apr 24, 2020 · 1 comment
Open
Labels
for: team-attention An issue we need to discuss as a team to make progress status: pending-design-work Needs design work before any code can be developed

Comments

@mp911de
Copy link
Member

mp911de commented Apr 24, 2020

With the growing flexibility and operation modes how databases are operated, there are use-cases (e.g. clustering, read-only mode) where these details can be passed directly to the connection retrieval.

With the current arrangement, a read-only flavor can be only passed through extensible transaction definitions, if at all (#159). Systems that manage transactions for applications (e.g. transaction managers) typically allocate a connection on transaction start (or when the unit of work begins) and then they prepare the connection according to the needs. In many cases, preparation requires a few roundtrips to the database.

Introducing connection definitions would allow specification of such details upfront so a driver can immediately return a connection that is e.g. suitable for read-only operations by utilizing replica connections. Another case would be transaction level isolation.

Introducing connection definitions would also introduce the constraint that some attributes may not be changed afterwards as e.g. a read-only-replica connection cannot be routed back to the writable primary server.

@mp911de mp911de added for: team-attention An issue we need to discuss as a team to make progress status: pending-design-work Needs design work before any code can be developed labels Apr 24, 2020
@mp911de
Copy link
Member Author

mp911de commented Mar 5, 2021

A parameterized ConnectionFactory.create introduces a lot of complexity for connection pools as pooled connection compliance to the requested ConnectionDefinition is unknown. Either the pool needs to request a new (unpooled) connection or maintain separate sub-pools. Neither is a good option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: team-attention An issue we need to discuss as a team to make progress status: pending-design-work Needs design work before any code can be developed
Projects
None yet
Development

No branches or pull requests

1 participant