Re: Question about StartLogicalReplication() error path

Поиск
Список
Период
Сортировка
От Amit Kapila
Тема Re: Question about StartLogicalReplication() error path
Дата
Msg-id CAA4eK1+SDBGQ6Ds6k-hb+Q27vOy6VJ+7AqCdaeCptg1_kX-38A@mail.gmail.com
обсуждение исходный текст
Ответ на Question about StartLogicalReplication() error path  (Jeff Davis <pgsql@j-davis.com>)
Ответы Re: Question about StartLogicalReplication() error path  (Jeff Davis <pgsql@j-davis.com>)
Список pgsql-hackers
On Fri, Jun 11, 2021 at 7:38 AM Jeff Davis <pgsql@j-davis.com> wrote:
>
> StartLogicalReplication() calls CreateDecodingContext(), which says:
>
>   else if (start_lsn < slot->data.confirmed_flush)
>   {
>     /*
>      * It might seem like we should error out in this case, but it's
>      * pretty common for a client to acknowledge a LSN it doesn't
> have to
>      * do anything for, and thus didn't store persistently, because the
>      * xlog records didn't result in anything relevant for logical
>      * decoding. Clients have to be able to do that to support
> synchronous
>      * replication.
>      */
>      ...
>      start_lsn = slot->data.confirmed_flush;
>   }
>
..
..
>
> I'm not sure I understand the comment overall. Why would the client
> request something that it has already acknowledged,
>

Because sometimes clients don't have to do anything for xlog records.
One example is WAL for DDL where logical decoding didn't produce
anything for the client but later with keepalive we send the LSN of
WAL where DDL has finished and the client just responds with the
position sent by the server as it doesn't have any other pending
transactions.

> and why would the
> server override that and just advance to the confirmed_lsn?
>

I think because there is no need to process the WAL that has been
confirmed by the client. Do you see any problems with this scheme?

-- 
With Regards,
Amit Kapila.



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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Release 14 Beta 2
Следующее
От: Noah Misch
Дата:
Сообщение: Re: PoC/WIP: Extended statistics on expressions