Re: Function to get invalidation cause of a replication slot. - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Function to get invalidation cause of a replication slot.
Date
Msg-id ZYOuR7RtYaXbzX8_@paquier.xyz
Whole thread Raw
In response to Re: Function to get invalidation cause of a replication slot.  ("Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>)
Responses Re: Function to get invalidation cause of a replication slot.
List pgsql-hackers
On Wed, Dec 20, 2023 at 12:43:45PM +0100, Drouvot, Bertrand wrote:
> +           <literal>3</literal> = wal_level insufficient on the primary server
>
> "." is missing at the end (to be consistent with 1 and 2). Same
> in the commit message.
>
> + * Returns ReplicationSlotInvalidationCause enum value for valid slot_name;
>
> Not sure the sentence should finish with ";".
>
> Another Nit is to add a comment in ReplicationSlotInvalidationCause definition (slot.h)
> that any new enum values (if any) should be added after the ones that are already defined (to
> provide some consistency across changes in this area if any).
>
> Except the above Nit(s) the patch LGTM.

This patch has a problem: this design can easily cause the report of
data inconsistent with pg_replication_slots because the data returned
by pg_get_replication_slots() and pg_get_slot_invalidation_cause()
would happen across *two* function call contexts, no?  So, it seems to
me that this had better be integrated as an extra column of
pg_get_replication_slots() to ensure the consistency of the data
reported.  And it's critical to get consistent data for monitoring.

Not to mention that the lookup had better happen also while holding
ReplicationSlotControlLock as well, which is also something
InvalidatePossiblyObsoleteSlot() relies on.  v2 ignores that.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: pg_upgrade failing for 200+ million Large Objects
Next
From: Nathan Bossart
Date:
Subject: Re: Add new for_each macros for iterating over a List that do not require ListCell pointer