Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: [PagoPa-2421] - advisory lock #277

Merged
merged 24 commits into from
Dec 18, 2024
Merged

Conversation

alessio-acitelli
Copy link
Collaborator

@alessio-acitelli alessio-acitelli commented Dec 13, 2024

Depends on: INFRA PAGOPA-2421

List of Changes

  • changed some configurations to prevent the advisory lock problem

Motivation and Context

  • Error: Failed to execute goal org.flywaydb:flyway-maven-plugin:8.0.5:migrate (default-cli) on project gpd: org.flywaydb.core.api.FlywayException: Unable to release PostgreSQL advisory lock

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@alessio-acitelli alessio-acitelli marked this pull request as ready for review December 16, 2024 12:43
@alessio-acitelli alessio-acitelli requested a review from a team as a code owner December 16, 2024 12:43
@@ -86,6 +86,7 @@ microservice-chart:
WEBSITE_SITE_NAME: 'pagopa-d-gpd-core-service'
ENV: 'dev'
SPRING_DATASOURCE_URL: "jdbc:postgresql://gpd-db.d.internal.postgresql.pagopa.it:6432/apd?sslmode=require&prepareThreshold=0&tcpKeepAlive=true"
FLYWAY_DATASOURCE_URL: "jdbc:postgresql://gpd-db.d.internal.postgresql.pagopa.it:6432/apd?sslmode=require&prepareThreshold=0&tcpKeepAlive=true&lock_timeout=30000"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why add FLYWAY_DATASOURCE_URL if isnt'used ?and for flyway migration doesn't use6432( pgbouncer ) but directly5432`

@@ -1,4 +1,4 @@
flyway.user=${SPRING_DATASOURCE_USERNAME}
flyway.password=${SPRING_DATASOURCE_PASSWORD}
flyway.schemas=${GPD_SCHEMA_NAME}
flyway.url=${SPRING_DATASOURCE_URL}
flyway.url=${FLYWAY_DATASOURCE_URL}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export SPRING_DATASOURCE_URL='${{ secrets.DATASOURCE_URL }}'
is set via .identity

we need to add a new one secret

  env_secrets = {
...
    "DATASOURCE_URL": data.azurerm_key_vault_secret.key_vault_datasource_url.value,
  }

something like FLYWAY_DATASOURCE_URL
that use dns, 5432 and new param lock_timeout=30000 that tou hare rich out

@@ -86,6 +86,7 @@ microservice-chart:
WEBSITE_SITE_NAME: 'pagopa-p-gpd-core-service'
ENV: 'prod'
SPRING_DATASOURCE_URL: "jdbc:postgresql://gpd-db.p.internal.postgresql.pagopa.it:6432/apd?sslmode=require&prepareThreshold=0"
FLYWAY_DATASOURCE_URL: "jdbc:postgresql://gpd-db.p.internal.postgresql.pagopa.it:6432/apd?sslmode=require&prepareThreshold=0&lock_timeout=30000"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove it

@@ -86,6 +86,7 @@ microservice-chart:
WEBSITE_SITE_NAME: 'pagopa-u-gpd-core-service'
ENV: 'uat'
SPRING_DATASOURCE_URL: "jdbc:postgresql://gpd-db.u.internal.postgresql.pagopa.it:6432/apd?sslmode=require&prepareThreshold=0&tcpKeepAlive=true"
FLYWAY_DATASOURCE_URL: "jdbc:postgresql://gpd-db.u.internal.postgresql.pagopa.it:6432/apd?sslmode=require&prepareThreshold=0&tcpKeepAlive=true&lock_timeout=30000"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove it

@@ -19,7 +19,7 @@
<springdoc-version>1.6.6</springdoc-version>
<modelmapper-version>3.1.0</modelmapper-version>
<jackson-datatype-jsr310-version>2.13.1</jackson-datatype-jsr310-version>
<flyway-version>8.5.13</flyway-version>
<flyway-version>9.22.3</flyway-version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it works for pgFlex 15 vers too ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From 9.0.5 Flyway is compatible with PostgreSQL 15:
https://documentation.red-gate.com/fd/release-notes-for-flyway-engine-179732572.html
image

Abou PGFLEX: "The compatibility includes PostgreSQL-specific features and extensions such as custom schema handling and advanced SQL functions. However, Flyway itself does not explicitly manage extensions like pgFlex. To use such extensions, you need to ensure they are installed and configured in your PostgreSQL instance prior to running Flyway migrations​"

@alessio-acitelli alessio-acitelli added the bug Something isn't working label Dec 17, 2024
Copy link
Contributor

@pasqualespica pasqualespica left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 🆗

Copy link
Contributor

This pull request does not contain a valid label. Please add one of the following labels: [major, minor, patch, patch, skip]

@alessio-acitelli alessio-acitelli merged commit 2171b2e into main Dec 18, 2024
14 of 16 checks passed
@alessio-acitelli alessio-acitelli deleted the PAGOPA-2421-advisory-lock branch December 18, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size/small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants