From: sergiyvamz (@sergiyvamz) <noreply+sergiyvamz@github.com>
To: aws/aws-advanced-jdbc-wrapper <noreply+aws-aws-advanced-jdbc-wrapper@github.com>
Subject: [aws/aws-advanced-jdbc-wrapper] PR #2256: fix: pick a usable latest MySQL version for Multi-AZ tests
Date: Wed, 18 Nov 2026 17:32:56 +0000
Message-ID: <gh-aws-aws-advanced-jdbc-wrapper-2256@github.com> (raw)
### Summary
Fix the MySQL Multi-AZ "latest" integration test jobs that broke when RDS started listing MySQL 9.7.4.
### Description
Since 2026-11-18 "latest" resolves to MySQL 9.7.4 ([run 44257588283](https://github.com/aws/aws-advanced-jdbc-wrapper/actions/runs/44257588283), [run 44268634378](https://github.com/aws/aws-advanced-jdbc-wrapper/actions/runs/44268634378)). Multi-AZ DB clusters don't support it, so `CreateDBCluster` fails. On the Multi-AZ instance, the `mysql9.7` family defaults to `require_secure_transport=1`, so the MariaDB driver tests can't connect.
- Compare engine versions numerically. The string comparison picked 8.4.9 over 8.4.13.
- For Multi-AZ DB clusters, `latest` is the newest version with an orderable instance option that supports clusters.
- MySQL Multi-AZ instances get a DB parameter group with `require_secure_transport=0`, as Aurora MySQL already does.
### Additional Reviewers
### By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
inline patch 1: wrapper/src/test/java/integration/host/TestEnvironment.java, wrapper/src/test/java/integration/util/AuroraTestUtility.java (+112/-2 lines) download inline-1.patchdiff --git a/wrapper/src/test/java/integration/host/TestEnvironment.java b/wrapper/src/test/java/integration/host/TestEnvironment.javaindex b470fef50..f1f2a0de6 100644--- a/wrapper/src/test/java/integration/host/TestEnvironment.java+++ b/wrapper/src/test/java/integration/host/TestEnvironment.java@@ -507,6 +507,8 @@ private static void createCustomParameterGroups(TestEnvironment env) {
case RDS_MULTI_AZ_INSTANCE:
if (request.getDatabaseEngine() == DatabaseEngine.PG) {
createPgDbParameterGroup(env);
+ } else if (request.getDatabaseEngine() == DatabaseEngine.MYSQL) {+ createMysqlDbParameterGroup(env);
}
break;
default:
@@ -531,6 +533,14 @@ private static void createMysqlClusterParameterGroup(TestEnvironment env) {
env.info.setClusterParameterGroupName(groupName);
}
+ private static void createMysqlDbParameterGroup(TestEnvironment env) {+ String groupName = String.format("test-mysql-dpg-%s", env.info.getRandomBase());+ String engine = getDbEngine(env.info.getRequest());+ String engineVersion = getDbEngineVersion(engine, env);+ env.info.setDbParameterGroupName(groupName);+ env.auroraUtil.createMysqlDbParameterGroup(groupName, engine, engineVersion);+ }+
/**
* Creates the DB cluster parameter group that enables prepared (two-phase) transactions on a
* PostgreSQL cluster (Aurora or RDS multi-az), so that the XA tests can prepare a branch instead of
@@ -1287,6 +1297,11 @@ private static String findEngineVersion(
case "default":
return env.auroraUtil.getDefaultVersion(engineName);
case "latest":
+ final TestEnvironmentRequest request = env.info.getRequest();+ if (request.getDatabaseEngineDeployment() == DatabaseEngineDeployment.RDS_MULTI_AZ_CLUSTER) {+ return env.auroraUtil.getLatestMultiAzClusterVersion(+ engineName, env.auroraUtil.getDbInstanceClass(request));+ }
return env.auroraUtil.getLatestVersion(engineName);
default:
return systemPropertyVersion;
diff --git a/wrapper/src/test/java/integration/util/AuroraTestUtility.java b/wrapper/src/test/java/integration/util/AuroraTestUtility.javaindex 207256ea7..54a53a242 100644--- a/wrapper/src/test/java/integration/util/AuroraTestUtility.java+++ b/wrapper/src/test/java/integration/util/AuroraTestUtility.java@@ -34,6 +34,7 @@
import integration.container.TestEnvironment;
import java.io.BufferedReader;
import java.io.InputStreamReader;
+import java.math.BigInteger;
import java.net.InetAddress;
import java.net.URI;
import java.net.URISyntaxException;
@@ -52,7 +53,6 @@
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.Properties;
@@ -133,6 +133,7 @@
import software.amazon.awssdk.services.rds.model.DescribeDbInstancesRequest;
import software.amazon.awssdk.services.rds.model.DescribeDbInstancesResponse;
import software.amazon.awssdk.services.rds.model.DescribeDbParameterGroupsResponse;
+import software.amazon.awssdk.services.rds.model.DescribeOrderableDbInstanceOptionsRequest;
import software.amazon.awssdk.services.rds.model.FailoverDbClusterResponse;
import software.amazon.awssdk.services.rds.model.Filter;
import software.amazon.awssdk.services.rds.model.InvalidDbClusterStateException;
@@ -816,6 +817,45 @@ public void createPgDbParameterGroup(String groupName, String engine, String eng
}
}
+ /**+ * Creates a DB parameter group for an RDS MySQL instance (the multi-az instance deployment) that+ * disables require_secure_transport. RDS for MySQL 9.7 enables it by default, which rejects the+ * MariaDB driver's non-TLS test connections. This is the instance-level counterpart of+ * {@link #createMysqlClusterParameterGroup}.+ *+ * @param groupName the name of the parameter group to create+ * @param engine the database engine the group is created for+ * @param engineVersion the database engine version the group is created for+ */+ public void createMysqlDbParameterGroup(String groupName, String engine, String engineVersion) {+ CreateDbParameterGroupResponse response = rdsClient.createDBParameterGroup(+ CreateDbParameterGroupRequest.builder()+ .dbParameterGroupName(groupName)+ .description("Test DB parameter group with require_secure_transport disabled.")+ .dbParameterGroupFamily(this.getParameterGroupFamily(engine, engineVersion))+ .tags(this.getTag())+ .build());++ if (!response.sdkHttpResponse().isSuccessful()) {+ throw new RuntimeException("Error creating MySQL DB parameter group. " + response.sdkHttpResponse());+ }++ ModifyDbParameterGroupResponse response2 = rdsClient.modifyDBParameterGroup(+ ModifyDbParameterGroupRequest.builder()+ .dbParameterGroupName(groupName)+ .parameters(Parameter.builder()+ .parameterName("require_secure_transport")+ .parameterValue("0")+ .applyMethod(ApplyMethod.IMMEDIATE)+ .build())+ .build());++ if (!response2.sdkHttpResponse().isSuccessful()) {+ throw new RuntimeException(+ "Error setting require_secure_transport=0. " + response2.sdkHttpResponse());+ }+ }+
/**
* PostgreSQL disables prepared (two-phase) transactions by default
* ({@code max_prepared_transactions = 0}), which makes {@code XAResource.prepare} fail with
@@ -2528,10 +2568,65 @@ public List<String> getEngineVersions(String engine) {
public String getLatestVersion(String engine) {
return getEngineVersions(engine).stream()
.filter(version -> !version.contains("limitless"))
- .max(Comparator.naturalOrder())+ .max(AuroraTestUtility::compareEngineVersions)
.orElse(null);
}
+ /**+ * Returns the latest engine version that can be used to create an RDS Multi-AZ DB cluster with the+ * given instance class. RDS lists engine versions that Multi-AZ DB clusters don't support yet (for+ * example MySQL 9.7), and {@code CreateDBCluster} rejects them.+ *+ * @param engine the database engine, for example {@code mysql}+ * @param instanceClass the instance class the cluster is created with+ * @return the latest supported engine version, or null if there is none+ */+ public String getLatestMultiAzClusterVersion(String engine, String instanceClass) {+ final List<String> versions = getEngineVersions(engine).stream()+ .filter(version -> !version.contains("limitless"))+ .sorted((a, b) -> compareEngineVersions(b, a))+ .collect(Collectors.toList());+ for (String version : versions) {+ if (supportsMultiAzCluster(engine, version, instanceClass)) {+ return version;+ }+ LOGGER.finest(String.format(+ "Skipping %s %s: it can't be used for a Multi-AZ DB cluster with instance class %s.",+ engine, version, instanceClass));+ }+ return null;+ }++ private boolean supportsMultiAzCluster(String engine, String engineVersion, String instanceClass) {+ return rdsClient.describeOrderableDBInstanceOptionsPaginator(+ DescribeOrderableDbInstanceOptionsRequest.builder()+ .engine(engine)+ .engineVersion(engineVersion)+ .dbInstanceClass(instanceClass)+ .build())+ .orderableDBInstanceOptions()+ .stream()+ .anyMatch(option -> Boolean.TRUE.equals(option.supportsClusters()));+ }++ /**+ * Compares engine versions part by part, numerically where both parts are numbers, so that+ * {@code 8.4.13} is newer than {@code 8.4.9}. A plain string comparison gets this wrong.+ */+ static int compareEngineVersions(String a, String b) {+ final String[] partsA = a.split("[._-]");+ final String[] partsB = b.split("[._-]");+ for (int i = 0; i < Math.min(partsA.length, partsB.length); i++) {+ final int result = partsA[i].matches("\\d+") && partsB[i].matches("\\d+")+ ? new BigInteger(partsA[i]).compareTo(new BigInteger(partsB[i]))+ : partsA[i].compareTo(partsB[i]);+ if (result != 0) {+ return result;+ }+ }+ return Integer.compare(partsA.length, partsB.length);+ }+
public String getDefaultVersion(String engine) {
final DescribeDbEngineVersionsResponse versions = rdsClient.describeDBEngineVersions(
DescribeDbEngineVersionsRequest.builder().defaultOnly(true).engine(engine).build()