Re: Physical replication slot advance is not persistent
От
Kyotaro Horiguchi
Тема
Re: Physical replication slot advance is not persistent
Дата
Msg-id
20191225.130337.442597881772691026.horikyota.ntt@gmail.com
Ответ на
Physical replication slot advance is not persistent (Alexey Kondratov)
Список
Дерево обсуждения
Physical replication slot advance is not persistent Alexey Kondratov <a.kondratov@postgrespro.ru>
Re: Physical replication slot advance is not persistent Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: Physical replication slot advance is not persistent Alexey Kondratov <a.kondratov@postgrespro.ru>
Re: Physical replication slot advance is not persistent Alexey Kondratov <a.kondratov@postgrespro.ru>
Re: Physical replication slot advance is not persistent Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: Physical replication slot advance is not persistent Alexey Kondratov <a.kondratov@postgrespro.ru>
Re: Physical replication slot advance is not persistent Alexey Kondratov <a.kondratov@postgrespro.ru>
Re: Physical replication slot advance is not persistent Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: Physical replication slot advance is not persistent Alexey Kondratov <a.kondratov@postgrespro.ru>
Re: Physical replication slot advance is not persistent Michael Paquier <michael@paquier.xyz>
Re: Physical replication slot advance is not persistent Andres Freund <andres@anarazel.de>
Re: Physical replication slot advance is not persistent Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: Physical replication slot advance is not persistent Michael Paquier <michael@paquier.xyz>
Re: Physical replication slot advance is not persistent Michael Paquier <michael@paquier.xyz>
Re: Physical replication slot advance is not persistent Andres Freund <andres@anarazel.de>
Re: Physical replication slot advance is not persistent Alexey Kondratov <a.kondratov@postgrespro.ru>
Re: Physical replication slot advance is not persistent Michael Paquier <michael@paquier.xyz>
Re: Physical replication slot advance is not persistent Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: Physical replication slot advance is not persistent Alexey Kondratov <a.kondratov@postgrespro.ru>
Re: Physical replication slot advance is not persistent Michael Paquier <michael@paquier.xyz>
Re: Physical replication slot advance is not persistent Alexey Kondratov <a.kondratov@postgrespro.ru>
Re: Physical replication slot advance is not persistent Amit Kapila <amit.kapila16@gmail.com>
Re: Physical replication slot advance is not persistent Michael Paquier <michael@paquier.xyz>
Re: Physical replication slot advance is not persistent Michael Paquier <michael@paquier.xyz>
Re: Physical replication slot advance is not persistent Craig Ringer <craig@2ndquadrant.com>
Re: Physical replication slot advance is not persistent Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: Physical replication slot advance is not persistent Alexey Kondratov <a.kondratov@postgrespro.ru>
Re: Physical replication slot advance is not persistent Michael Paquier <michael@paquier.xyz>
Re: Physical replication slot advance is not persistent Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: Physical replication slot advance is not persistent Michael Paquier <michael@paquier.xyz>
Re: Physical replication slot advance is not persistent Alexey Kondratov <a.kondratov@postgrespro.ru>
Re: Physical replication slot advance is not persistent a.kondratov@postgrespro.ru
Re: Physical replication slot advance is not persistent Craig Ringer <craig@2ndquadrant.com>
Re: Physical replication slot advance is not persistent Michael Paquier <michael@paquier.xyz>
Re: Physical replication slot advance is not persistent Craig Ringer <craig@2ndquadrant.com>
At Tue, 24 Dec 2019 20:12:32 +0300, Alexey Kondratov wrote in
> I dig into the code and it happens because of this if statement:
>
> /* Update the on disk state when lsn was updated. */
> if (XLogRecPtrIsInvalid(endlsn))
> {
> ReplicationSlotMarkDirty();
> ReplicationSlotsComputeRequiredXmin(false);
> ReplicationSlotsComputeRequiredLSN();
> ReplicationSlotSave();
> }
Yes, it seems just broken.
> Attached is a small patch, which fixes this bug. I have tried to
> stick to the same logic in this 'if (XLogRecPtrIsInvalid(endlsn))'
> and now pg_logical_replication_slot_advance and
> pg_physical_replication_slot_advance return InvalidXLogRecPtr if
> no-op.
>
> What do you think?
I think we shoudn't change the definition of
pg_*_replication_slot_advance since the result is user-facing.
The functions return a invalid value only when the slot had the
invalid value and failed to move the position. I think that happens
only for uninitalized slots.
Anyway what we should do there is dirtying the slot when the operation
can be assumed to have been succeeded.
As the result I think what is needed there is just checking if the
returned lsn is equal or larger than moveto. Doen't the following
change work?
- if (XLogRecPtrIsInvalid(endlsn))
+ if (moveto <= endlsn)
reagrds.
--
Kyotaro Horiguchi
NTT Open Source Software Center
В списке pgsql-hackers по дате отправления
От: Michael Paquier
Дата: