aws / aws/aws-advanced-go-wrapper

Do StaleDnsHelper and the Aurora initial connection plugin stay inactive when the DSN uses a custom domain?

Open
#588 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
78
Forks
12
Avg merge
3d 20h
Merged PRs (30d)
13

Description

We reach an Aurora MySQL cluster through a custom domain, a CNAME pointing at the writer cluster endpoint, with `clusterInstanceHostPattern` set. During failover testing `StaleDnsHelper` never did anything. Pointing the DSN at the real cluster endpoint and changing nothing else made it active right away, and it logged several "Stale DNS data detected" reconnections.

Reading the source, that looks deliberate. Both checks look at the host string in the DSN:

- [`stale_dns_helper.go#L52`](https://github.com/aws/aws-advanced-go-wrapper/blob/877b430/awssql/plugins/stale_dns_helper.go#L52) returns the connection without verifying it unless `IsWriterClusterDns(host)` or `IsGlobalDbWriterClusterDns(host)`.
- [`aurora_initial_connection_strategy_plugin.go#L114-L115`](https://github.com/aws/aws-advanced-go-wrapper/blob/877b430/awssql/plugins/aurora_initial_connection_strategy_plugin.go#L114-L115) returns early unless `IdentifyRdsUrlType(hostInfo.GetHost()).IsRdsCluster`.

[`IsWriterClusterDns`](https://github.com/aws/aws-advanced-go-wrapper/blob/877b430/awssql/utils/rds_utils.go#L136) matches the host against the Aurora DNS regexes, which all require an AWS domain, so a custom domain cannot satisfy either check. Neither check uses `clusterInstanceHostPattern`. [`rds_host_list_provider.go#L103`](https://github.com/aws/aws-advanced-go-wrapper/blob/877b430/awssql/driver_infrastructure/rds_host_list_provider.go#L103) reads it only to build instance endpoints from topology rows.

Questions:

1. With `clusterInstanceHostPattern` set, does the wrapper support a custom domain in front of a cluster endpoint, or must the DSN use the cluster endpoint for the failover protections to run?
2. If it is a limitation, could the failover docs say so? [UsingTheBlueGreenPlugin.md](https://github.com/aws/aws-advanced-go-wrapper/blob/877b430/docs/user-guide/using-plugins/UsingTheBlueGreenPlugin.md#L21) says CNAME aliases are not supported, but only for Blue/Green, while [UsingTheFailoverPlugin.md](https://github.com/aws/aws-advanced-go-wrapper/blob/877b430/docs/user-guide/using-plugins/UsingTheFailoverPlugin.md#L30) describes `clusterInstanceHostPattern` as the parameter to use when connecting through a custom domain.
3. Is `utils.SetPreparedHostFunc` meant for user code? The only callers are the wrapper's own integration tests.

### The AWS Advanced Go Wrapper version used

`awssql/v2` v2.0.2, `mysql-driver` v1.1.2

### Go version used

go1.26.4 darwin/arm64

### Operating System and version

macOS 26.5 (arm64)

Contributor guide

Open the contributing guide

Research direction

Start with awssql/plugins/stale_dns_helper.go, awssql/plugins/aurora_initial_connection_strategy_plugin.go, awssql/utils/rds_utils.go, and awssql/driver_infrastructure/rds_host_list_provider.go to trace the host checks and clusterInstanceHostPattern handling. Compare the behavior and wording in UsingTheFailoverPlugin.md and UsingTheBlueGreenPlugin.md. Done requires a maintainer decision on custom-domain support, with implementation or clarified documentation and relevant tests if the scope is accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, mysql
Domain
databases, documentation, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.