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

⚠️ Upgrade Postgres version from 14.6 to 16.2 #627

Merged
merged 6 commits into from
Jun 11, 2024

Conversation

KevinJBoyer
Copy link
Contributor

@KevinJBoyer KevinJBoyer commented Jun 6, 2024

Ticket

Resolves #523

Changes

  • Bump from 14.6 to 16.2
  • Add documentation to describe how to do a major version change if desired.

Small tweaks to the code to make upgrading major versions slightly easier:

  • Specify allow_major_version_change = false -- this is the default, but making it explicit makes it easier for teams to know where this should be updated when they need to change it to true
  • Remove revocation of create on public schema from role_manager.py -- this is now the default as of Postgres 15, but I'm leaving this behavior "as is" so folks can continue to use the infra template with past versions of Postgres safely.
  • Suffix the name of the parameter group with the major engine version. This saves a small manual step when doing a major database change, since otherwise users have to edit the Terraform to assign a new name.

Context for reviewers

  • 16.2 was released in April 2024 and includes bug fixes for 16.1.
  • You can see a full list of changes from 14.6 -> 16.2 here: https://why-upgrade.depesz.com/show?from=14.6&to=16.2&keywords=
  • Note that the idea behind providing documentation is that a team should be able to upgrade to a future release of the infra template without being required to also update their database at the same time, so teams in such a position can upgrade the infra template and then manually revert the DB version number to their desired state and then upgrade in the future at their leisure.

Testing

  • I manually tested the instructions on my AWS account:
    image

  • I reviewed this list for potential incompatibilities between 14 and 15, and this list of potential incompatibilities between 15 and 16.

  • Besides a change to default permissions, I don't think there are any incompatibilities with the infra template.

    • One exception, I'm a bit confused about this release note in 16: Role inheritance now controls the default inheritance status of member roles added during [GRANT](https://www.postgresql.org/docs/16/sql-grant.html)
  • I will put up sibling PRs that check this for the Application Flask template (and the NextJS one if it uses a database as well.)

2. (if needed) Update the `serverlessv2_scaling_configuration`

Set the `min_capacity` to 4.0 (and adjust the `max_capacity` accordingly).
If your minimum is lower than this, the upgrade will fail with `FATAL: shared memory segment sizes are configured too large`.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Once committed, this documentation will be the second reference ever to this error on Google 🙃

Copy link
Contributor

@lorenyu lorenyu left a comment

Choose a reason for hiding this comment

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

Rollout notes: Once this is merged we'll need to run through these migration steps on the platform-test and https://github.com/navapbc/platform-test-flask repos. Lemme know if you need access to the AWS accounts for those

docs/infra/upgrade-database.md Outdated Show resolved Hide resolved
docs/infra/upgrade-database.md Outdated Show resolved Hide resolved
infra/modules/database/role_manager/manage.py Outdated Show resolved Hide resolved
@KevinJBoyer KevinJBoyer merged commit d411e78 into main Jun 11, 2024
9 checks passed
@KevinJBoyer KevinJBoyer deleted the kb/bump-postgres-version branch June 11, 2024 13:22
@lorenyu lorenyu changed the title Bump to 16.2 ⚠️ Upgrade Postgres version from 14.6 to 16.2 Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Postgres 16
3 participants