repmgr prevents postgresql upgrade?
Closed this issue · 2 comments
I am trying to upgrade a prototype postgresql 12 master to 13. The host is Ubuntu 18.04 with both 12 and 13 postgresql + repmgr installed. When running pg_upgradecluster without -m upgrade, it just hangs. With -m upgrade, it fails with an error related to repmgr's database.
pg_upgradecluster 12 main
pg_upgradecluster 12 main -m upgrade
In pg_upgrade_server.log:
2020-12-08 16:41:21.665 EST [78369] postgres@repmgr STATEMENT: CREATE FUNCTION "repmgr"."am_bdr_failover_handler"(integer) RETURNS boolean
LANGUAGE "c" STRICT
AS '$libdir/repmgr', 'am_bdr_failover_handler';
-- For binary upgrade, handle extension membership the hard way
ALTER EXTENSION "repmgr" ADD FUNCTION "repmgr"."am_bdr_failover_handler"(integer);
postgres@mc-3015-postgres-1804:/var/log/postgresql/pg_upgradecluster-12-13-main.te8P$ dpkg -l | grep postgres
ii pgdg-keyring 2018.2 all keyring for apt.postgresql.org
ii postgresql-12 12.5-1.pgdg18.04+1 amd64 object-relational SQL database, version 12 server
ii postgresql-12-repmgr 5.2.0-2.pgdg18.04+1 amd64 replication manager for PostgreSQL 12
ii postgresql-13 13.1-1.pgdg18.04+1 amd64 object-relational SQL database, version 13 server
ii postgresql-13-repmgr 5.2.0-2.pgdg18.04+1 amd64 replication manager for PostgreSQL 13
ii postgresql-client-12 12.5-1.pgdg18.04+1 amd64 front-end programs for PostgreSQL 12
ii postgresql-client-13 13.1-1.pgdg18.04+1 amd64 front-end programs for PostgreSQL 13
ii postgresql-client-common 223.pgdg18.04+1 all manager for multiple PostgreSQL client versions
ii postgresql-common 223.pgdg18.04+1 all PostgreSQL database-cluster manager
Full logs:
pg_upgradecluster-12-13-main.tar.gz
I am not very familiar with postgresql or repmgr, so my mistake might be obvious. Thanks.
See the relevant documentation section: https://repmgr.org/docs/current/upgrading-and-pg-upgrade.html
Basically you should upgrade repmgr on the old cluster before running pg_upgrade
on PostgreSQL itself.
Thanks. I knew I was forgetting something; I did try to upgrade repmgr but couldn't. I updated the apt packages to 5.2, but ran into this error:
postgres@mc-3015-postgres-1804:~$ repmgr -f /etc/repmgr.conf primary register
INFO: connecting to primary database...
ERROR: an older version of the "repmgr" extension is installed
DETAIL: version 5.0 is installed but newer version 5.2 is available
HINT: update the installed extension version by executing "ALTER EXTENSION repmgr UPDATE"
postgres=# ALTER EXTENSION repmgr UPDATE;
ERROR: extension "repmgr" does not exist
postgres=#
But just now I realized that the extension is database-specific, not global, so \c repmgr
was required to update the extension:
postgres=# \c repmgr
repmgr=# ALTER EXTENSION repmgr UPDATE;
ALTER EXTENSION
Perhaps this is obvious to others, but the HINT was not clear to me.
postgres@mc-3015-postgres-1804:~$ pg_upgradecluster 12 main -m upgrade
appears to have succeeded now. Thank you for your help!