Re: Function to get invalidation cause of a replication slot.

Поиск
Список
Период
Сортировка
От Amit Kapila
Тема Re: Function to get invalidation cause of a replication slot.
Дата
Msg-id CAA4eK1JcfBaMhrk7mrsj7-9g6p3KCBa7iBULjBBkw2ETD1NPzQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Function to get invalidation cause of a replication slot.  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: Function to get invalidation cause of a replication slot.  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
On Thu, Dec 21, 2023 at 11:18 AM Michael Paquier <michael@paquier.xyz> wrote:
>
> On Thu, Dec 21, 2023 at 09:37:39AM +0530, Amit Kapila wrote:
> > It depends on how one uses the function. For example, if one finds
> > there is a conflict via pg_get_replication_slots() and wants to check
> > the reason for the same via this new function then it would give the
> > correct answer.
>
> My point is that we may not get the "correct" answer at all :/
>
> What guarantee do you have that between the scan of
> pg_get_replication_slots() to get the value of "conflicting" and the
> call of pg_get_slot_invalidation_cause() the slot state will still be
> the same?
>

Yeah, if one uses them independently then there is no such guarantee.

>  A lot could happen between both function calls while the
> repslot LWLock is not hold.
>
> > Now, if we think it is okay to have two columns
> > 'conflicting' and 'conflict_reason/conflict_cause' to be returned by
> > pg_get_replication_slots() then that should serve the purpose as well
> > but one can argue that 'conflicting' is deducible from
> > 'conflict_reason'.
>
> Yeah, you could keep the reason text as NULL when there is no
> conflict, replacing the boolean by the text in the function, and keep
> the view definition compatible with v16 while adding an extra column.
>

But as mentioned we also want the enum value to be exposed in some way
so that it can be used by the sync slot feature [1] as well,
otherwise, we may need some mappings to convert the text back to an
enum. I guess if we want to expose via view, then we can return an
enum value by pg_get_replication_slots() and the view can replace it
with text based on the value.

[1] -
https://www.postgresql.org/message-id/OS0PR01MB5716DAF72265388A2AD424119495A%40OS0PR01MB5716.jpnprd01.prod.outlook.com

--
With Regards,
Amit Kapila.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: speed up a logical replica setup
Следующее
От: Peter Smith
Дата:
Сообщение: Re: GUC names in messages