public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ron Johnson <[email protected]>
To: pgsql-general <[email protected]>
Subject: Re: Questions on Upgrading PostgreSQL from 15.0 to 15.9 and Setting Up Streaming Replication
Date: Sun, 24 Nov 2024 17:15:18 -0500
Message-ID: <CANzqJaCz3c5upkQ8QvkX89FL+zvx3S1Ko0_0ODuEvBYvqR9YUw@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAD=40Z3Rvbx46SxYBBdLvgSObXCP+Firszz++rDTXmGX795D2Q@mail.gmail.com>
	<[email protected]>
	<CAD=40Z1wJ7mBej9=Yqfo_1m-eOV61E=s6yDjZSaTBESbGunBUA@mail.gmail.com>
	<[email protected]>
	<CAD=40Z3prwhLAedetocCu3jFvHSBP44V6O9d6CXjvzLTw7eOUQ@mail.gmail.com>
	<CANzqJaACBw1=jCAxGwSeu7dh4UfD2KePcNqSOC3=WwzXrg0skQ@mail.gmail.com>
	<CAD=40Z3k2dgVidM3oYuMWsauHyKF9v-0i4nOfMXd917PtNiO_g@mail.gmail.com>
	<[email protected]>
	<CANzqJaANutDZy-bRCC1Sf0X7=LtF2HHMBfk73_MmVyXBReL4=w@mail.gmail.com>
	<[email protected]>
	<CANzqJaCbagpPpt6mhjA1UDCJ6xpHV-SWim6vOCWKcZjRjuSm=g@mail.gmail.com>
	<[email protected]>

On Sun, Nov 24, 2024 at 4:58 PM Adrian Klaver <[email protected]>
wrote:

> On 11/24/24 13:00, Ron Johnson wrote:
> > On Sun, Nov 24, 2024 at 2:55 PM Christophe Pettus <[email protected]
> > <mailto:[email protected]>> wrote:
> >
> >      > On Nov 24, 2024, at 09:15, Ron Johnson <[email protected]
> >     <mailto:[email protected]>> wrote:
> >      >
> >      > Doesn't the existence of a replication slot force PG to retain
> >     WAL files when replication is broken?
> >
> >     It does.  I don't recall if the OP said that they were using a
> >     persistent replication slot or not; it's not as common with binary
> >     replication as with logical replication.
> >
> >
> > Really? I wonder why people fight with configuring max_wal_size and
> > wal_keep_size, when replication slots do all the work for you.
>
> https://www.postgresql.org/docs/current/logicaldecoding-explanation.html
>
> "
> Caution
>
> Replication slots persist across crashes and know nothing about the
> state of their consumer(s). They will prevent removal of required
> resources even when there is no connection using them. This consumes
> storage because neither required WAL nor required rows from the system
> catalogs can be removed by VACUUM as long as they are required by a
> replication slot. In extreme cases this could cause the database to shut
> down to prevent transaction ID wraparound (see Section 24.1.5). So if a
> slot is no longer required it should be dropped.
> "
>

Nagios has built-in disk space monitoring, and if it doesn't also have
built-in replication monitoring, you can write a plug-in.  Or write your
own bash script that periodically runs "SELECT * from
pg_replication_slots;" and "SELECT * FROM pg_stat_replication;" on the
primary and "SELECT * FROM pg_stat_wal_receiver;" on the secondary.

Whichever you do, some monitoring should always be in place.

"
> Caution
>
> There is a chance that the old primary is up again during the promotion
> and if subscriptions are not disabled, the logical subscribers may
> continue to receive data from the old primary server even after
> promotion until the connection string is altered. This might result in
> data inconsistency issues, preventing the logical subscribers from being
> able to continue replication from the new primary server.
> "
>

Logical replication is off-topic for this problem, no?

-- 
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!


view thread (5+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: Questions on Upgrading PostgreSQL from 15.0 to 15.9 and Setting Up Streaming Replication
  In-Reply-To: <CANzqJaCz3c5upkQ8QvkX89FL+zvx3S1Ko0_0ODuEvBYvqR9YUw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox