Skip to content

Why is it needed WARNING: 'primary_conninfo' is set but 'conninfo' does not point to a standby server. Ignoring 'primary_conninfo' ? #1166

Open

Description

@ofigenov

I have version 3.16 of Barman, and I can see from the source code that this is still the case. Since some update, we've started getting this warning, which constantly clutters the screen and logs. I even had to clear the message for monitoring tools like Zabbix. I decided to figure out why it was triggered, since my conninfo points to a replica, and I couldn't figure out why it was suddenly indicating it was the master. I dug into the code and found out...

https://github.com/EnterpriseDB/barman/blob/release/3.16.0/barman/server.py#L312

                if self.postgres.is_in_recovery is False:
                    self.postgres.close()
                    self.postgres = None
                    output.warning(
                        "'primary_conninfo' is set but 'conninfo' does not point to a "
                        "standby server. Ignoring 'primary_conninfo'."
                    )

I was trying to figure out at what point conninfo is overridden by the master connection, and it seems to be here
https://github.com/EnterpriseDB/barman/blob/release/3.16.0/barman/config.py#L1137

       if self.wal_conninfo is not None:
            overrides["conninfo"] = self.wal_conninfo
        elif self.wal_streaming_conninfo is not None:
            overrides["conninfo"] = self.wal_streaming_conninfo
        wal_conninfo = overrides.get("conninfo", self.conninfo)

        if overrides:
            message_parts = [
                f"'{key}' overridden with '{value}'" for key, value in overrides.items()
            ]
            # Only display message if its not a check command!
            if not check_strategy:
                output.info(
                    "Configuration overrides applied: %s", " and ".join(message_parts)
                )
        return wal_streaming_conninfo, wal_conninfo

Honestly, I don't understand the logic here. Could you explain? Why do you need to replace conninfo from wal_streaming_conninfo and then issue a warning about it? It looks like a bug. The documentation says that if you want wals to be taken from the master, use wal_streaming_conninfo and simultaneously use conninfo to create base copies from the replica. Why replace conninfo, and especially why issue a warning about it, if you're deliberately replacing it with wal_streaming_conninfo, which definitely connects to the master?

p.s. I tried removing primary_conninfo. Without it, the warning disappears, but backups to the DB with low activity hang because it waits for the WAL file to fill up, and with primary_conninfo, the WAL switch occurs automatically.

Activity

  1. martinmarques commented on Apr 6, 2026

    @martinmarques
    Contributor

    Could you please start by showing your barman configuration? The snippet you shared doesn't modify conninfo. If modifies wal_conninfo in some occasions

  2. ofigenov commented on Apr 6, 2026

    @ofigenov
    Author

    conninfo = host=replica-host port=5432 user=barman dbname=postgres connect_timeout=5
    archiver = false
    active = true
    archiver_batch_size = 1024
    backup_method = postgres
    backup_options = concurrent_backup
    check_timeout = 90
    compression = pigz
    last_backup_maximum_age = 3 DAYS
    minimum_redundancy = 1
    recovery_options = get-wal
    retention_policy = RECOVERY WINDOW OF 6 DAYS
    retention_policy_mode = auto
    slot_name = barman
    streaming_archiver = true
    streaming_archiver_batch_size = 1024
    wal_streaming_conninfo = host=master-host port=5432 user=barman connect_timeout=5 dbname=postgres
    primary_conninfo = host=master-host port=5432 user=barman connect_timeout=5 dbname=postgres
    primary_checkpoint_timeout = 60

    about

    Could you please start by showing your barman configuration? The snippet you shared doesn't modify conninfo. If modifies wal_conninfo in some occasions

    If conninfo indicates a connection to a replica, where else could the connection to the master be? Can you point to that location?

  3. ofigenov commented on Apr 6, 2026

    @ofigenov
    Author

    I also found this in my barman's log:

    Configuration overrides applied: 'streaming_conninfo' overridden with 'host=master-host port=5432 user=barman connect_timeout=5 dbname=postgres' and 'conninfo' overridden with 'host=master-host port=5432 user=barman connect_timeout=5 dbname=postgres'
    WARNING: 'primary_conninfo' is set but 'conninfo' does not point to a standby server. Ignoring 'primary_conninfo'.

    That's what led me to this piece of code.

           if self.wal_conninfo is not None:
                overrides["conninfo"] = self.wal_conninfo
            elif self.wal_streaming_conninfo is not None:
                overrides["conninfo"] = self.wal_streaming_conninfo
            wal_conninfo = overrides.get("conninfo", self.conninfo)
    
            if overrides:
                message_parts = [
                    f"'{key}' overridden with '{value}'" for key, value in overrides.items()
                ]
                # Only display message if its not a check command!
                if not check_strategy:
                    output.info(
                        "Configuration overrides applied: %s", " and ".join(message_parts)
                    )
            return wal_streaming_conninfo, wal_conninfo
    

    https://github.com/EnterpriseDB/barman/blob/release/3.16.0/barman/config.py#L1137

    This clearly indicates that conninfo is being replaced by a connection to the master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions