Project

General

Profile

Actions

Bug #20926

closed

Need to install postgresql-client matching database version

Added by Peter Amstutz 8 months ago. Updated 8 months ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
Deployment
Story points:
-
Release relationship:
Auto

Description

In order to run database migrations, it requires pg_dump matching the major version of postgreqsl used on the database. For example, ubuntu 20.04 has postgresql 12, but AWS RDS has postgresql 15, which means in order for the database migration to work, we need to ensure that we have pg_dump from the postgresql-client-15 package.

The installer should include a parameter specifying the major version of the database and ensure that the correct client package is installed on the nodes with controller role.


Subtasks 1 (0 open1 closed)

Task #20952: Review 20926-installer-pg-client-versionResolvedLucas Di Pentima09/12/2023Actions

Related issues

Related to Arvados - Bug #20889: Installer potholesResolvedLucas Di Pentima08/25/2023Actions
Actions #1

Updated by Peter Amstutz 8 months ago

  • Release set to 66
  • Assigned To set to Lucas Di Pentima
  • Description updated (diff)
Actions #2

Updated by Peter Amstutz 8 months ago

Actions #3

Updated by Peter Amstutz 8 months ago

  • Description updated (diff)
Actions #4

Updated by Lucas Di Pentima 8 months ago

  • Status changed from New to In Progress
Actions #5

Updated by Lucas Di Pentima 8 months ago

After lots of trial & error I finally saw what was my misunderstanding about the postgres-formula. The update is super simple.

Updates at 78668c47f - branch 20926-installer-pg-client-version

  • Adds DATABASE_POSTGRESQL_VERSION configuration on local.params with default set to '12'
  • Uses DATABASE_POSTGRESQL_VERSION in the postgresql.sls pillar.
  • Adds postgres.client state to the controller so that it gets the matching version postgresql-client package installed.

Did manual tests with database and controller roles on separate nodes using version 15 and confirmed that all got installed correctly.

Actions #6

Updated by Lucas Di Pentima 8 months ago

  • Target version changed from Development 2023-09-13 sprint to Development 2023-09-27 sprint
Actions #7

Updated by Brett Smith 8 months ago

Lucas Di Pentima wrote in #note-5:

  • Adds DATABASE_POSTGRESQL_VERSION configuration on local.params with default set to '12'

My two cents from an ops perspective: I don't think it makes sense for this setting to have a default value. It's necessarily going to depend on the deployment environment (does the installer install the PostgreSQL server or use an existing one?) and distribution. Having a default seems like a gotcha for when you forget to set it. It seems safer to just force people to set it.

Actions #8

Updated by Lucas Di Pentima 8 months ago

Brett Smith wrote in #note-7:

Lucas Di Pentima wrote in #note-5:

  • Adds DATABASE_POSTGRESQL_VERSION configuration on local.params with default set to '12'

My two cents from an ops perspective: I don't think it makes sense for this setting to have a default value. It's necessarily going to depend on the deployment environment (does the installer install the PostgreSQL server or use an existing one?) and distribution. Having a default seems like a gotcha for when you forget to set it. It seems safer to just force people to set it.

Yes, you make a good point here. I was just keeping the previous status quo of having the v12 as the default, with the addition of making it configurable instead of "hardcoded" on the salt's pillar.

The installer installs v12 on the node with the database role. IMO in that case, having a functional default is better than requiring the admin to make that decision. WDYT about making a check to set v12 as default when the database role is being used, and ask the admin to set it otherwise?

Actions #9

Updated by Brett Smith 8 months ago

Brett Smith wrote in #note-7:

The installer installs v12 on the node with the database role. IMO in that case, having a functional default is better than requiring the admin to make that decision. WDYT about making a check to set v12 as default when the database role is being used, and ask the admin to set it otherwise?

Setting a default only if you use the database role sounds good to me. I guess my only question then is, why v12? I'm under the impression we're using that just because it's the version on the release of Debian/Ubuntu we install most. But if we can install different versions, why not default to the latest?

Actions #10

Updated by Lucas Di Pentima 8 months ago

Brett Smith wrote in #note-9:

I guess my only question then is, why v12? I'm under the impression we're using that just because it's the version on the release of Debian/Ubuntu we install most. But if we can install different versions, why not default to the latest?

Not sure if there're incompatibilities or other issues with newer PG versions, I tend to agree to use the newest but I would like to double check with others.

Actions #11

Updated by Lucas Di Pentima 8 months ago

Updates at 5e1a45ef8

  • Requires manually setting PG version when not using the 'database' role.

I left version 12 for now, but whenever we want to change it, it's now set on common.sh.

Actions #12

Updated by Lucas Di Pentima 8 months ago

Updates at 4e527029e
Test run: test-provision-debian11: #498

  • Sets PG v15 as a default
Actions #13

Updated by Lucas Di Pentima 8 months ago

Updates at 284a699
Test run: test-provision-debian11: #500

  • Sets default PG version on single host case too.
Actions #14

Updated by Brett Smith 8 months ago

Not sure if there're incompatibilities or other issues with newer PG versions, I tend to agree to use the newest but I would like to double check with others.

I mean, I thought part of the motivation for this branch was because we have a user deployed with PostgreSQL 15 in RDS? Plus for whatever it's worth I can run the test suite against PostgreSQL 15 on my Debian 12 system. So just for ticket posterity, my understanding is we have some reasons to believe it works, and no reasons to believe it doesn't.

Just one minor suggestion on the states manipulation, to narrow the regexp to avoid accidental false matches, I would suggest writing it as:

grep -q "^ +- postgres\.client$" ${STATES_TOP} || echo "    - postgres.client" >> ${STATES_TOP}
  • I'm guessing you removed the front anchor to be more flexible about leading space, this is hopefully a good balance between that and strictness.
  • Escaping the . avoids matching "postgres_client" or whatever.

(It would be super cool if this grep || sed recipe was a repeatable function, but you definitely don't need to go that far for this branch.)

Thanks.

Actions #15

Updated by Lucas Di Pentima 8 months ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Resolved
Actions

Also available in: Atom PDF