feat: preferred connection type pg only#1623
Open
Rattenkrieg wants to merge 1 commit intoeclipse-vertx:masterfrom
Open
feat: preferred connection type pg only#1623Rattenkrieg wants to merge 1 commit intoeclipse-vertx:masterfrom
Rattenkrieg wants to merge 1 commit intoeclipse-vertx:masterfrom
Conversation
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.
targetServerTypesupport for PostgreSQL multi-host connection pools, matching the semantics of pgjdbc'stargetServerTypeand libpq'starget_session_attrs;ConnectionFactoryarchitecture;ANY,PRIMARY,SECONDARY,PREFER_PRIMARY, andPREFER_SECONDARYmodes;in_hot_standbyGUC_REPORT (zero-cost, during handshake) withSHOW transaction_read_onlyfallback for older versions;Differences from #1064
ConnectionFactoryper host - 5.xConnectionFactory.connect()takes options per-call, so aServerType[]array indexed by server position replaces per-factory state;detectServerTypefails after connect, the connection is explicitly closed before retrying. Preferred server type connection factory #1064 did not handle this path;Connection algorithm
The
ServerTypeAwarePgConnectionFactorywrapsPgConnectionFactoryand manages a list of servers with round-robin selection:PRIMARY/SECONDARY(strict): Probes servers in round-robin order, returns the first match, closes mismatched connections. Fails with an error if no server of the desired type is found;PREFER_PRIMARY/PREFER_SECONDARY: Two-pass approach matching pgjdbc - strict pass first;(probe-and-close for mismatches), then falls back to connectToAny which accepts any reachable server regardless of type;
ANY: Connects to the first reachable server with no type detection;