Skip to content

Commit ee84ea4

Browse files
committed
fix issue with blue/green metadata for PG databases
1 parent 3477343 commit ee84ea4

File tree

4 files changed

+83
-1
lines changed

4 files changed

+83
-1
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Run Blue/Green Integration Tests Latest
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
id-token: write # This is required for requesting the JWT
11+
contents: read # This is required for actions/checkout
12+
13+
jobs:
14+
all-bg-integration-tests-latest:
15+
name: Run Blue/Green integration tests with latest engine version
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
testTask: [ "mysql-aurora-mariadb-driver", "mysql-aurora-mysql-driver", "mysql-rds-instance-mariadb-driver", "mysql-rds-instance-mysql-driver", "pg-aurora", "pg-rds-instance" ]
21+
steps:
22+
- name: 'Clone repository'
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 50
26+
- name: 'Set up JDK 8'
27+
uses: actions/setup-java@v4
28+
with:
29+
distribution: 'corretto'
30+
java-version: 8
31+
- name: 'Configure AWS credentials'
32+
uses: aws-actions/configure-aws-credentials@v4
33+
id: creds
34+
with:
35+
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_DEPLOY_ROLE }}
36+
role-session-name: run_bg_integration_test_latest
37+
role-duration-seconds: 21600
38+
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
39+
output-credentials: true
40+
- name: Run Blue/Green integration tests
41+
run: |
42+
./gradlew --no-parallel --no-daemon test-bgd-${{ matrix.testTask }}
43+
env:
44+
AURORA_CLUSTER_DOMAIN: ${{ secrets.DB_CONN_SUFFIX }}
45+
RDS_DB_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
46+
AWS_ACCESS_KEY_ID: ${{ steps.creds.outputs.aws-access-key-id }}
47+
AWS_SECRET_ACCESS_KEY: ${{ steps.creds.outputs.aws-secret-access-key }}
48+
AWS_SESSION_TOKEN: ${{ steps.creds.outputs.aws-session-token }}
49+
MYSQL_VERSION: "latest"
50+
PG_VERSION: "latest"
51+
- name: Mask data
52+
run: |
53+
./gradlew --no-parallel --no-daemon maskJunitHtmlReport
54+
- name: Archive junit results for ${{ matrix.testTask }}
55+
if: always()
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: junit-report-latest-${{ matrix.testTask }}
59+
path: ./wrapper/build/test-results
60+
retention-days: 5
61+
- name: Archive html summary report for ${{ matrix.testTask }}
62+
if: always()
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: html-summary-report-latest-${{ matrix.testTask }}
66+
path: ./wrapper/build/report
67+
retention-days: 5

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
@@ -58,6 +58,7 @@
5858
TestEnvironmentFeatures.PERFORMANCE,
5959
TestEnvironmentFeatures.RUN_HIBERNATE_TESTS_ONLY,
6060
TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY,
61+
TestEnvironmentFeatures.BLUE_GREEN_DEPLOYMENT,
6162
TestEnvironmentFeatures.RUN_DB_METRICS_ONLY})
6263
@MakeSureFirstInstanceWriter
6364
@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)