barman icon indicating copy to clipboard operation
barman copied to clipboard

Barman - check server returns wrong results for Replication Slot

Open thoro opened this issue 4 months ago • 7 comments

Hi,

I have a configuration that sets the following variables:

conninfo = host=backup-db port=5432 user=postgres
primary_conninfo= host=live-db port=5432 user=postgres
streaming_conninfo = host=live-db port=5432 user=postgres
wal_streaming_conninfo = host=live-db port=5432 user=postgres
wal_conninfo = host=live-db port=5432 user=postgres
ssh_command = ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no postgres@backup-db

The issue is that the check server always return that the replication slot is not created, even though receive-wal (started through barman cron) is active:

	replication slot: FAILED (replication slot 'barman_streaming_replication' doesn't exist. Please execute 'barman receive-wal --create-slot database')

I also have verified the replication slot on the main db, and it's active and working with exactly the same name.

I tracked it down I think to the change of primary_conninfo (I upgraded from 2.11). I changed a bit in postgres.py:~1709

self.primary = PostgreSQLConnection(self.primary_conninfo, slot_name=slot_name)

and also added the function:

 def fetch_remote_status(self):
        return self.primary.fetch_remote_status();

This allows the check to finish successfully. Can someone take a more detailed look?

thoro avatar Oct 14 '24 17:10 thoro