Skip to content

Commit f3d47b8

Browse files
committed
fix issue with blue/green metadata for PG databases
1 parent 92c97cd commit f3d47b8

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

wrapper/src/main/java/software/amazon/jdbc/plugin/bluegreen/BlueGreenStatusMonitor.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,10 @@ protected void collectStatus() {
428428
// It's normal to expect that the status table has no entries after BGD is completed.
429429
// Old1 cluster/instance has been separated and no longer receives
430430
// updates from related green cluster/instance.
431+
// Metadata at new blue cluster/instance can be removed after switchover, and it's also expected to get
432+
// no records.
431433
if (this.role != BlueGreenRole.SOURCE) {
432-
LOGGER.warning(() -> Messages.get("bgd.noEntriesInStatusTable", new Object[] {this.role}));
434+
LOGGER.finest(() -> Messages.get("bgd.noEntriesInStatusTable", new Object[] {this.role}));
433435
}
434436
this.currentPhase = null;
435437
}
@@ -489,6 +491,15 @@ protected void collectStatus() {
489491
if (!this.isConnectionClosed(conn)) {
490492
// It's normal to get connection closed during BGD switchover.
491493
// If connection isn't closed but there's an exception then let's log it.
494+
495+
// For PG databases
496+
if (e.getMessage() != null
497+
&& e.getMessage().contains("An error occured while retrieving the blue/green fast switchover metadata")) {
498+
this.currentPhase = BlueGreenPhase.NOT_CREATED;
499+
return;
500+
}
501+
502+
// Let's log it.
492503
if (LOGGER.isLoggable(Level.FINEST)) {
493504
LOGGER.log(Level.FINEST, Messages.get("bgd.unhandledSqlException", new Object[] {this.role}), e);
494505
}

wrapper/src/test/java/integration/container/tests/hibernate/HibernateTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
TestEnvironmentFeatures.PERFORMANCE,
5858
TestEnvironmentFeatures.RUN_HIBERNATE_TESTS_ONLY,
5959
TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY,
60+
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT,
6061
TestEnvironmentFeatures.RUN_DB_METRICS_ONLY})
6162
@MakeSureFirstInstanceWriter
6263
@Order(21)

wrapper/src/test/java/integration/util/AuroraTestUtility.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,9 @@ public DatabaseEngine getRdsInstanceEngine(final DBInstance instance) {
10481048
public String getAuroraParameterGroupFamily(String engine, String engineVersion) {
10491049
switch (engine) {
10501050
case "aurora-postgresql":
1051+
if (StringUtils.isNullOrEmpty(engineVersion) || engineVersion.startsWith("17.")) {
1052+
return "aurora-postgresql17";
1053+
}
10511054
return "aurora-postgresql16";
10521055
case "aurora-mysql":
10531056
if (StringUtils.isNullOrEmpty(engineVersion) || engineVersion.contains("8.0")) {

0 commit comments

Comments
 (0)