Re: show primary_conninfo unchanged after promotion?

From: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
To: Wiwwo Staff <wiwwo(at)wiwwo(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: show primary_conninfo unchanged after promotion?
Date: 2022-05-18 14:15:28
Message-ID: CAB8KJ=gfmfT8GmFsLffvB8uu95hML9MS2deRhrpHPQ5TO_ZKmA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2022年5月18日(水) 23:07 Wiwwo Staff <wiwwo(at)wiwwo(dot)com>:
>
> Hi!
> i might be doing something wrong, but I cannot see what...
>
> Server is 14.3 (Debian 14.3-1.pgdg110+1)
> (at the time of writing, in Dockerfile FROM postgres:14)
>
> I have a 3 node cluster, starting with pg_red (172.26.0.2) as primary.
> I promote pg_green (172.26.0.4) as new primary, all other aligned.
>
> Now, on pg_green (172.26.0.4):
>
> =# select inet_server_addr();
> inet_server_addr
> ------------------
> 172.26.0.4
>
> =# select pg_is_in_recovery();
> pg_is_in_recovery
> -------------------
> f
>
> =# select * from pg_stat_replication; (CUT)
> pid | usesysid | usename | application_name | client_addr
> -----+----------+---------+------------------+-------------
> 486 | 16,384 | rep | walreceiver | 172.21.0.2
> 625 | 16,384 | rep | walreceiver | 172.21.0.4
>
> But, if I execute show primary_conninfo, i get
> =# show primary_conninfo ;
> primary_conninfo
> ------------------------------------------------------------------------------------------------------------------------------------------------------------
> user=rep passfile='/.pgpass' channel_binding=prefer host=pg_red port=5432 sslmode=prefer sslcompression=0 sslsni=1 ssl_min_protocol_version=TLSv1.2 g.
> .ssencmode=prefer krbsrvname=postgres target_session_attrs=any
>
> which says primary is pg_red, which is the old primary.

You're not doing anything wrong, it's just that the value of
primary_conninfo is left untouched after promotion. It is however
ignored if the server is a primary; see:

https://www.postgresql.org/docs/current/runtime-config-replication.html#GUC-PRIMARY-CONNINFO

which states: "This setting has no effect if the server is not in standby mode."

Regards

Ian Barwick

--
EnterpriseDB: https://www.enterprisedb.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dominique Devienne 2022-05-18 15:31:19 Re: Who am I? Where am I connected?
Previous Message Wiwwo Staff 2022-05-18 14:07:31 show primary_conninfo unchanged after promotion?