Skip to content

fix: propagate configuration profile to eagerly-created topology monitor (#2020)#2021

Open
sergiyvamz wants to merge 1 commit into
mainfrom
fix/issue-2020-topology-monitor-iam-profile
Open

fix: propagate configuration profile to eagerly-created topology monitor (#2020)#2021
sergiyvamz wants to merge 1 commit into
mainfrom
fix/issue-2020-topology-monitor-iam-profile

Conversation

@sergiyvamz

@sergiyvamz sergiyvamz commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #2020 (a reopening of #1800).

When the plugin list is configured through a class-based ConfigurationProfile (ConfigurationProfileBuilder.withPluginFactories(...)) rather than the wrapperPlugins string, the cluster topology monitor could still lose the profile-configured plugins (notably iam). Its background connections then authenticate without IAM and fail once the cached IAM token expires (~15 min), e.g.:

PSQLException: The server requested password-based authentication, but no password was provided by plugin null.

Root cause

PR #1802 and PR #1919 wired the configuration profile through the monitor's minimal service container, so in the common case the monitor inherits the profile correctly. The remaining gap is an ordering problem in ServiceUtility.createStandardServiceContainer:

  • PluginServiceImpl marks the dialect as confirmed immediately when a dialect is supplied via the profile (or wrapperDialect), and Global Aurora (GDB) deployments are confirmed up front automatically.
  • With a confirmed dialect, pluginService.refreshHostList() inside createStandardServiceContainer eagerly creates and caches the ClusterTopologyMonitorImpl.
  • That happened before servicesContainer.setConfigurationProfile(configurationProfile) was called, so the monitor's minimal container read a null profile and fell back to DEFAULT_PLUGINS (initialConnection,auroraConnectionTracker,failover2,efm2) - no iam.

This matches the reporter's observation that adding iam to the wrapperPlugins string works around it: the string path (PATH B) is only reached when the profile is missing.

Fix

Set the configuration profile on the services container before creating the host list provider and refreshing the host list, so any eagerly-created topology monitor inherits it. This is a semantics-preserving move of a field setter to an earlier point in the same method; the container's final state is unchanged.

Tests

  • ServiceUtilityTest (unit): drives the real createStandardServiceContainer with a profile-supplied dialect and a host list provider that records the container's configuration profile at refresh() time (the exact point the monitor would be created). Verified it fails without the fix (expected: <profile> but was: <null>) and passes with it.
  • AwsIamIntegrationTest#test_AwsIam_TopologyMonitorInheritsProfilePlugins (integration): configures plugins via withPluginFactories (iam, auroraConnectionTracker, failover2), confirms the dialect up front, connects IAM-only (no password) to an Aurora cluster, then forces a verified topology refresh. This drives the monitor to open its own connections through its plugin chain, which only succeeds if it inherited the iam plugin. Gated with @EnableOnTestFeature(IAM) + @EnableOnDatabaseEngineDeployment(AURORA) + @DisableOnTestDriver(MARIADB).

…tor (#2020)

When plugins are configured via a class-based ConfigurationProfile (withPluginFactories) and a dialect is supplied (so isDialectConfirmed() is true up front, as with Global Aurora), createStandardServiceContainer's refreshHostList() can eagerly create and cache the cluster topology monitor before setConfigurationProfile() runs on the container. The monitor's minimal service container then reads a null profile and falls back to the default plugin list (no iam), so its connections to IAM-only databases fail once the cached IAM token expires.

Fix: set the configuration profile on the services container before initializing the host list provider and refreshing the host list.

Adds a ServiceUtilityTest unit regression test and an AwsIamIntegrationTest integration test that reproduces the IAM-only topology monitor scenario.
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.

ConfigurationProfile plugin list ignored - still

1 participant