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

MBS-13361: Upgrade the required version of PostgreSQL to 16 #3234

Merged
merged 2 commits into from
May 3, 2024

Conversation

mwiencek
Copy link
Member

@mwiencek mwiencek commented Apr 14, 2024

Problem

As explained in MBS-13361 and the schema change announcement blog post, we're requiring PostgreSQL 16 as of May 13.

Solution

Update our documentation and Docker test images to reference v16.

Testing

Ran the automated tests, plus have been using PostgreSQL v16 locally without issues for quite some time.

Copy link
Member

@reosarevok reosarevok left a comment

Choose a reason for hiding this comment

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

Tests pass - looking at https://www.postgresql.org/about/featurematrix/ I don't see any obvious places where we should refactor to use a much better new solution but you might, are there any?

@@ -49,8 +49,8 @@ sub RequireMinimumPostgreSQLVersion

my $version = $sql->select_single_value(q{SELECT current_setting('server_version_num')});

if ($version < 12000) {
die 'MusicBrainz requires PostgreSQL 12 or later';
if ($version < 160000) {

Choose a reason for hiding this comment

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

Suggested change
if ($version < 160000) {
if ($version < 16000) {

Copy link
Member

Choose a reason for hiding this comment

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

Surprised this didn't cause any issues with our tests, don't we test InitDb? Or is 160000 also valid, @mwiencek?

Copy link
Member Author

@mwiencek mwiencek Apr 15, 2024

Choose a reason for hiding this comment

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

Thanks, I intended to leave a comment here but forgot. The previous check was incorrect; they increased the length of the number when their versioning system changed with major release 10. Here you can see what numbers are returned for v12, 15, and 16 respectively:

psql (12.16 (Ubuntu 12.16-1.pgdg22.04+1))
Type "help" for help.

musicbrainz_db=> SELECT current_setting('server_version_num');
 current_setting
-----------------
 120016
(1 row)
psql (15.6 (Homebrew), server 15.5 (Homebrew))
Type "help" for help.

musicbrainz_db=> SELECT current_setting('server_version_num');
 current_setting
-----------------
 150005
(1 row)
psql (16.1 (Debian 16.1-1.pgdg120+1))
Type "help" for help.

musicbrainz_json_dump=> SELECT current_setting('server_version_num');
 current_setting
-----------------
 160001
(1 row)

Surprised this didn't cause any issues with our tests, don't we test InitDb?

Yes, but we don't test this particular condition (nor multiple versions of PostgreSQL). Edit: To be clear, our tests hit this condition, but the check always fails; we don't test that it would pass with an older version of postgres.

@mwiencek
Copy link
Member Author

Tests pass - looking at https://www.postgresql.org/about/featurematrix/ I don't see any obvious places where we should refactor to use a much better new solution but you might, are there any?

The one feature I saw as immediately useful is the new MERGE statement, but it would take some time to identify situations where we could make use of it. We certainly have many such cases though.

@mwiencek mwiencek added this to the Schema Change 2024 Q2 milestone May 3, 2024
@mwiencek mwiencek changed the base branch from master to schema-change-2024-q2 May 3, 2024 15:12
@mwiencek mwiencek merged commit ca49fa8 into metabrainz:schema-change-2024-q2 May 3, 2024
0 of 2 checks passed
@mwiencek mwiencek deleted the mbs-13361 branch May 3, 2024 15:18
yvanzo pushed a commit that referenced this pull request May 9, 2024
As explained in MBS-13361 and the schema change announcement blog post [1],
we're requiring PostgreSQL 16 as of May 13.

[1] https://blog.metabrainz.org/2024/03/12/schema-change-release-may-13-2024/
yvanzo added a commit that referenced this pull request May 13, 2024
* schema-change-2024-q2:
  MBS-11962: Update privileges for all database users on schema changes
  Add `@FULL_SCHEMA_LIST` to constants
  Split upgrade script for MBS-13514
  Remove `CONCURRENTLY` from inside transaction blocks
  MBS-13421: Add support for genre collections (#3183)
  Fix a couple issues with the Solr test service
  Set a new musicbrainz-tests tag for the schema change
  CheckSchemaMigration.sh: restore previous t/sql/initial.sql
  Fix installing pending.so
  MBS-13403: Drop unused priority column from link_type (#3179)
  MBS-12359: Refactor _columns implementation in data model (#3192)
  MBS-13361: Require PostgreSQL 16 (#3234)
  MBS-13514: Support 6-digit label codes (#3208)
yvanzo added a commit that referenced this pull request May 13, 2024
* master:
  Update POT files using the production database
  Update Yarn version to the latest 4.2.2
  Fix installing our xgettext-js fork using Yarn v4
  MBS-11962: Update privileges for all database users on schema changes
  Add `@FULL_SCHEMA_LIST` to constants
  Split upgrade script for MBS-13514
  Amend 2e89f39: Limit to USER triggers
  Remove reference to `a_ins_instrument` trigger from t/sql/initial.sql
  Remove `CONCURRENTLY` from inside transaction blocks
  MBS-13421: Add support for genre collections (#3183)
  Fix a couple issues with the Solr test service
  Set a new musicbrainz-tests tag for the schema change
  Verify the OpenJDK/Solr release checksums
  Update Java and Solr versions in Dockerfile.tests
  CheckSchemaMigration.sh: restore previous t/sql/initial.sql
  Fix installing pending.so
  MBS-13557: Set a Referrer-Policy on login/register pages (#3245)
  MBS-13403: Drop unused priority column from link_type (#3179)
  MBS-12359: Refactor _columns implementation in data model (#3192)
  MBS-13361: Require PostgreSQL 16 (#3234)
  MBS-13514: Support 6-digit label codes (#3208)
yvanzo added a commit that referenced this pull request May 13, 2024
* beta:
  Update translation files
  Update POT files using the production database
  Update Yarn version to the latest 4.2.2
  Fix installing our xgettext-js fork using Yarn v4
  MBS-11962: Update privileges for all database users on schema changes
  Add `@FULL_SCHEMA_LIST` to constants
  Split upgrade script for MBS-13514
  Remove `CONCURRENTLY` from inside transaction blocks
  MBS-13421: Add support for genre collections (#3183)
  Fix a couple issues with the Solr test service
  Set a new musicbrainz-tests tag for the schema change
  Verify the OpenJDK/Solr release checksums
  Update Java and Solr versions in Dockerfile.tests
  CheckSchemaMigration.sh: restore previous t/sql/initial.sql
  Fix installing pending.so
  MBS-13557: Set a Referrer-Policy on login/register pages (#3245)
  MBS-13403: Drop unused priority column from link_type (#3179)
  MBS-12359: Refactor _columns implementation in data model (#3192)
  MBS-13361: Require PostgreSQL 16 (#3234)
  MBS-13514: Support 6-digit label codes (#3208)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants