Repository navigation
Conversation
karenc-bq
force-pushed
the
fix/host-list-provider-initialization
branch
from
October 14, 2026 15:58
6d70ebe to
69c14e6
Compare
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.
Description
The async host list provider was built before any connection existed, picked by checking the configured plugins against a hardcoded list of those that require topology. That list has to be updated whenever such a plugin is added. Moreover, instead of checking against the plugins, the provider should be determined by the database dialect that knows the cluster's topology shape.
This PR updates the async path to determine the correct host list provider using methods from the database dialects, matching the sync driver behaviour.
Provider selection moved onto the dialect.
_build_host_list_providerinaio/wrapper.pydecided the provider from a hardcoded_TOPOLOGY_REQUIRING_PLUGINSfrozenset, then substring-matched"MultiAz"and"GlobalAurora"against the dialect's class name and scraped private query constants off it withgetattr(..., None), falling back to the Aurora provider whenever a lookup came back empty. A dialect not matching those substrings silently got the wrong topology SQL. The dialect now supplies its own provider viaget_async_host_list_provider_supplier().Async verification skipped PostgreSQL and could only make one hop.
update_database_dialectreturned early and marked the dialect settled for any driver other thanaiomysql, and for MySQL hardcoded a singleAuroraMysqlDialectcheck rather than readingdialect_update_candidates. PostgreSQL kept its pattern guess for the life of the connection, and chained upgrades such as Aurora MySQL to Global Aurora MySQL were unreachable. Verification now runs throughquery_for_dialect_async, which walks the chain for both engines.Dialect identification is rule data, not ten hand-written bodies.
is_dialectcould not be reused by the async path:def is_dialectcannot be overridden byasync def, and the sync probe runs through a thread pool that cannot accept an async connection. Newdialect_verifier.pyholds each dialect's queries and row predicates as data, with a sync and an async runner over them.A candidate that could not be asked was treated as fatal. On Aurora the Multi-AZ rule always errors, because
rds_toolsand the topology table are absent there, so verification raised instead of trying the next candidate and left every Aurora cluster endpoint unconfirmed with its topology queries deferred. An erroring candidate is now skipped, the same answer as one returning no rows. The skip is silent, so a candidate failing for an unexpected reason leaves no trace.Topology queries now wait for a confirmed dialect, in both engines.
PluginServicegainsis_dialect_confirmed, andRdsHostListProviderreports the hosts parsed from the connection properties until it is set, so no provider builds a topology monitor around a guessed dialect's SQL.Two async defects from the trailing slash on
HostInfo.url.urlisas_alias()plus a slash, so availability marks written keyed by alias and read keyed by url never matched and every mark was dropped; keys are now normalised, and the liveHostInfois marked too because host selection reads the object directly. The connection tracker also parsed the port out of a url, soint("3306/")raised and the port fell back to 5432, leaving a demoted MySQL writer's connections un-invalidated.Four log calls named message keys that do not exist. A missing key raises, and the logger falls back to the raw key only when no format arguments are passed.
FailoverV2Plugin._invalid_invocation_on_closed_connectionevaluatedMessages.getas a call argument, so it raised that error in place of theFailoverSuccessErrorit was about to raise, and a caller touching a connection failover had closed got an unrelated exception instead of the failover signal. Live since0b1ba85(feat: failover v2 plugin (#1079), 2026-01-27); the other three raise only with debug logging on.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.