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

don't set data_directory in config when we configure it via env #1577

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

evgeni
Copy link
Contributor

@evgeni evgeni commented Feb 21, 2024

Fixes: #1576

Summary

see subject and linked issue

Additional Context

Add any additional context about the problem here.

  • Root cause and the steps to reproduce. (If applicable)
  • Thought process behind the implementation.

Related Issues (if any)

#1576

Checklist

  • 🟢 Spec tests.
  • 🟢 Acceptance tests.
  • Manually verified. (For example puppet apply)

@ekohl
Copy link
Collaborator

ekohl commented Feb 21, 2024

I'm not sure the systemd check is relevant. Debian also starts it via systemd, but somehow does read data_directory via postgresql.conf.

Debian uses /usr/bin/pg_ctlcluster to start, which is a perl script. That sets -D $info{'pgdata'}. My perl isn't great, but I think it reads postgresql.conf to get the value.

The official postgresql.org packages on Red Hat match what the distro packages do:

Environment=PGDATA=/var/lib/pgsql/13/data/
ExecStart=/usr/pgsql-13/bin/postmaster -D ${PGDATA}

@evgeni
Copy link
Contributor Author

evgeni commented Feb 21, 2024

I'm not sure the systemd check is relevant. Debian also starts it via systemd, but somehow does read data_directory via postgresql.conf.

Well, this is where we set PGDATA explicitly. So it was a safe start.

Debian uses /usr/bin/pg_ctlcluster to start, which is a perl script. That sets -D $info{'pgdata'}. My perl isn't great, but I think it reads postgresql.conf to get the value.

-D really means "find postgresql.conf in that directory and run with it", which can point at a data_directory somewhere completely different (see https://www.postgresql.org/message-id/3566642.1618422939%40sss.pgh.pa.us)

The official postgresql.org packages on Red Hat match what the distro packages do:

Environment=PGDATA=/var/lib/pgsql/13/data/
ExecStart=/usr/pgsql-13/bin/postmaster -D ${PGDATA}

"good"

key => 'data_directory',
value => $datadir,
unless $facts['service_provider'] == 'systemd' and $facts['os']['family'] in ['RedHat', 'Gentoo'] {
postgresql::server::config_entry { "data_directory_for_instance_${name}":
Copy link
Collaborator

Choose a reason for hiding this comment

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

For upgrades, should we ensure it's absent on systemd + RH/Gentoo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably yes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

don't set data_directory in the config by default
3 participants