Track in pg_replication_slots the reason why slots conflict?

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Track in pg_replication_slots the reason why slots conflict?
Date: 2023-12-21 00:21:04
Message-ID: ZYOE8IguqTbp-seF@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,
(Bertrand and Andres in CC.)

While listening at Bertrand's talk about logical decoding on standbys
last week at Prague, I got surprised by the fact that we do not
reflect in the catalogs the reason why a conflict happened for a slot.
There are three of them depending on ReplicationSlotInvalidationCause:
- WAL removed.
- Invalid horizon.
- Insufficient WAL level.

This idea has been hinted around here on the original thread that led
to be87200efd93:
https://www.postgresql.org/message-id/d7547f2c-a0c3-6aad-b631-b7ed5efaf298@gmail.com
However v44 has picked up the idea of a boolean:
https://www.postgresql.org/message-id/bdc49e0b-cd39-bcd3-e391-b0ad6e48b5cf@gmail.com

ReplicationSlotCtl holds this information, so couldn't it be useful
for monitoring purposes to know why a slot got invalidated and add a
column to pg_get_replication_slots()? This could just be an extra
text conflicting_reason, defaulting to NULL when there's nothing to
see.

Thoughts?
--
Michael

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeremy Schneider 2023-12-21 00:29:02 Re: Built-in CTYPE provider
Previous Message Jeremy Schneider 2023-12-21 00:04:39 Re: Built-in CTYPE provider