don't set data_directory in config when we configure it via env
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)
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}
I'm not sure the systemd check is relevant. Debian also starts it via systemd, but somehow does read
data_directoryviapostgresql.conf.
Well, this is where we set PGDATA explicitly. So it was a safe start.
Debian uses
/usr/bin/pg_ctlclusterto start, which is a perl script. That sets-D $info{'pgdata'}. My perl isn't great, but I think it readspostgresql.confto 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"