]> git.proxmox.com Git - pmg-api.git/commit
add get_pg_server_version in PMG::Utils
authorStoiko Ivanov <s.ivanov@proxmox.com>
Thu, 8 Aug 2019 13:36:10 +0000 (15:36 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 9 Aug 2019 06:45:05 +0000 (08:45 +0200)
commit8ba633175a6d803192da9ae5dc130216ad0cdfe0
treed606b33e066b62081ff751dc04083901dee68085
parent6529020a8cd75dc7c0b2f852cdb7c6414c5bf039
add get_pg_server_version in PMG::Utils

PMG renders the postgresql.conf through its templating system (currently the
shipped template does not use any variables). postgresql.conf (in most
installations and in both debian and upstream packages) contains a few
occurrences (datadir, config files, pid-file, cluster name) of the postgres
major version number (see [0], for a description and why 9.6 and 11 are major
version numbers). The rendered config should use the correct version number
for the config of the currently used postgres installation (the one listening
on the default port (5432) and socket).

This fixes a bug observed while testing the upgrade to buster and postgres 11:
* a long running service (pmgmirror, pmgdaemon) still has the old config
  path in memory (/etc/postgresql/9.6/)
* while upgrading the pmg-api package the shipped template changes to one
  with the new major number (11)
* the next restart of the postgresql cluster fails, with an error not directly
  related to the broken config file

By reading [1] the version number through a connection to the current
postgresql server we rewrite the fitting configfile with the correct paths.

[0] https://www.postgresql.org/support/versioning/
[1] https://www.postgresql.org/docs/11/runtime-config-preset.html

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
src/PMG/Utils.pm