EnterpriseDB / repmgr

A lightweight replication manager for PostgreSQL (Postgres)

Home Page:https://repmgr.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Repmgr: an older version of the extension is installed but it's not true

mmartinello opened this issue · comments

I have a 3 nodes PostgreSQL cluster with PostgreSQL and repmgr.

Today I lost two nodes and I'm trying to re-clone it from the primary node.

If I try to clone it, repmgr complain that an older version of the extension is installed on the upstream node:

postgres@postgres3:~$ repmgr -h postgres2 -U repmgr -d repmgr -f /etc/repmgr.conf standby clone
NOTICE: destination directory "/var/lib/postgresql/12/main" provided
INFO: connecting to source node
DETAIL: connection string is: host=postgres2 user=repmgr dbname=repmgr
DETAIL: current installation size is 3484 MB
ERROR: an older version of the extension is installed on the upstream node
DETAIL: version 5.1 is installed but newer version 5.4 is available
HINT: upgrade "repmgr" on the source node first

But this seems not to be true, as the primary node is running the 5.4 version of the repmgr extension:

postgres=# select * from pg_available_extensions where name = 'repmgr';
  name  | default_version | installed_version |              comment
--------+-----------------+-------------------+------------------------------------
 repmgr | 5.4             | 5.4               | Replication manager for PostgreSQL
(1 row)

postgres=# ALTER EXTENSION repmgr UPDATE;
NOTICE:  version "5.4" of extension "repmgr" is already installed
ALTER EXTENSION

I tried to restart PostgreSQL on the primary node without solving the problem.

The error still happens and I really don't expect it to happen.

I also tried to execute the queries that repmgr executes to check the installed version, and I really don't see that the running version is different than the available one on postgres2 server:

postgres=# SELECT ae.name, e.extname,            ae.default_version,            (((FLOOR(ae.default_version::NUMERIC)::INT) * 10000) + (ae.default_version::NUMERIC - FLOOR(ae.default_version::NUMERIC)::INT) * 1000)::INT AS available,            ae.installed_version,            (((FLOOR(ae.installed_version::NUMERIC)::INT) * 10000) + (ae.installed_version::NUMERIC - FLOOR(ae.installed_version::NUMERIC)::INT) * 1000)::INT AS installed      FROM pg_catalog.pg_available_extensions ae LEFT JOIN pg_catalog.pg_extension e        ON e.extname=ae.name           WHERE ae.name='repmgr'
;
  name  | extname | default_version | available | installed_version | installed
--------+---------+-----------------+-----------+-------------------+-----------
 repmgr | repmgr  | 5.4             |     50400 | 5.4               |     50400
(1 row)

I've also tried to connect to specify the IP address on the -h parameter to be sure that it connects to the correct server but the problem is still there.

I'm really stucked on this problem and I have the cluster without two nodes.

Could you help me to understand where I'm wrong, please?

Thank you very much!

My fault.
I realised that the extension was updated only for the postgres user and not for the repmgr user!

Executing ALTER EXTENSION repmgr UPDATE as repmgr user on the PostgreSQL server solved my issue!

Thank you!