Re: persist logical slots to disk during shutdown checkpoint

Поиск
Список
Период
Сортировка
От Amit Kapila
Тема Re: persist logical slots to disk during shutdown checkpoint
Дата
Msg-id CAA4eK1KYO6cuPxY-yiR+Fd2U8=BH+G-PX=de5vGbBeoQRXrS7w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: persist logical slots to disk during shutdown checkpoint  (Julien Rouhaud <rjuju123@gmail.com>)
Ответы Re: persist logical slots to disk during shutdown checkpoint  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
Список pgsql-hackers
On Sat, Aug 19, 2023 at 12:46 PM Julien Rouhaud <rjuju123@gmail.com> wrote:
>
> On Sat, 19 Aug 2023, 14:16 Amit Kapila, <amit.kapila16@gmail.com> wrote:
>>
>
>> The idea discussed in the thread [1] is to always persist logical
>> slots to disk during the shutdown checkpoint. I have extracted the
>> patch to achieve the same from that thread and attached it here. This
>> could lead to some overhead during shutdown (checkpoint) if there are
>> many slots but it is probably a one-time work.
>>
>> I couldn't think of better ideas but another possibility is to mark
>> the slot as dirty when we update the confirm_flush LSN (see
>> LogicalConfirmReceivedLocation()). However, that would be a bigger
>> overhead in the running server as it could be a frequent operation and
>> could lead to more writes.
>
>
> Yeah I didn't find any better option either at that time. I still think that forcing persistence on shutdown is the
bestcompromise. If we tried to always mark the slot as dirty, we would be sure to add regular overhead but we would
probablyend up persisting the slot on disk on shutdown anyway most of the time, so I don't think it would be a good
compromise.
>

The other possibility is that we introduce yet another dirty flag for
slots, say dirty_for_shutdown_checkpoint which will be set when we
update confirmed_flush LSN. The flag will be cleared each time we
persist the slot but we won't persist if only this flag is set. We can
then use it during the shutdown checkpoint to decide whether to
persist the slot.

--
With Regards,
Amit Kapila.



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

Предыдущее
От: jian he
Дата:
Сообщение: Re: PostgreSQL 16 release announcement draft
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: WIP: new system catalog pg_wait_event