Re: Spinlock is missing when updating two_phase of ReplicationSlot

2023-01-11 Thread Masahiko Sawada
On Thu, Jan 12, 2023 at 1:42 PM Michael Paquier wrote: > > On Wed, Jan 11, 2023 at 02:36:17PM +0900, Michael Paquier wrote: > > 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

Re: Spinlock is missing when updating two_phase of ReplicationSlot

2023-01-11 Thread Michael Paquier
On Wed, Jan 11, 2023 at 02:36:17PM +0900, Michael Paquier wrote: > 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 inco

Re: Spinlock is missing when updating two_phase of ReplicationSlot

2023-01-10 Thread Michael Paquier
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 spi

Spinlock is missing when updating two_phase of ReplicationSlot

2023-01-10 Thread Masahiko Sawada
Hi, I realized that in CreateDecodingContext() function, we update both slot->data.two_phase and two_phase_at without acquiring the spinlock: /* Mark slot to allow two_phase decoding if not already marked */ if (ctx->twophase && !slot->data.two_phase) { slot->data.two_phase =