Re: Spinlock is missing when updating two_phase of ReplicationSlot

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Spinlock is missing when updating two_phase of ReplicationSlot
Дата
Msg-id Y75K0XU8rn7G3jYj@paquier.xyz
обсуждение исходный текст
Ответ на Spinlock is missing when updating two_phase of ReplicationSlot  (Masahiko Sawada <sawada.mshk@gmail.com>)
Ответы Re: Spinlock is missing when updating two_phase of ReplicationSlot
Список pgsql-hackers
On Wed, Jan 11, 2023 at 11:07:05AM +0900, Masahiko Sawada wrote:
> I think we should acquire the spinlock when updating fields of the
> replication slot even by its owner. Otherwise readers could see
> inconsistent results. Looking at another place where we update
> two_phase_at, we acquire the spinlock:
>
>     SpinLockAcquire(&slot->mutex);
>     slot->data.confirmed_flush = ctx->reader->EndRecPtr;
>     if (slot->data.two_phase)
>         slot->data.two_phase_at = ctx->reader->EndRecPtr;
>     SpinLockRelease(&slot->mutex);
>
> It seems to me an oversight of commit a8fd13cab0b. I've attached the
> small patch to fix it.

Looks right to me, the paths updating the data related to the slots
are careful about that, even when it comes to fetching a slot from
MyReplicationSlot.  I have been looking around the slot code to see if
there are other inconsistencies, and did not notice anything standing
out.  Will fix..
--
Michael

Вложения

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: [PATCH] Support using "all" for the db user in pg_ident.conf
Следующее
От: Nathan Bossart
Дата:
Сообщение: Re: delay starting WAL receiver