Re: Atomics in localbuf.c

2020-03-09 Thread Robert Haas
On Fri, Mar 6, 2020 at 2:06 PM Andres Freund wrote: > > Since local/shared buffers share the buffer header definition, we still > > have to use proper functions to access > > the atomic variables. > > There's only one struct BufferDesc. We could separate them out / > introduce a union or such. Bu

Re: Atomics in localbuf.c

2020-03-06 Thread Andres Freund
Hi, On 2020-03-06 11:26:41 -0500, Robert Haas wrote: > On Fri, Mar 6, 2020 at 2:04 AM Antonin Houska wrote: > > ok. What I missed is that BufferDesc.state is declared as pg_atomic_uint32 > > rather than plain int, so the pg_atomic_...() functions should be used > > regardless the buffer is shared

Re: Atomics in localbuf.c

2020-03-06 Thread Robert Haas
On Fri, Mar 6, 2020 at 2:04 AM Antonin Houska wrote: > ok. What I missed is that BufferDesc.state is declared as pg_atomic_uint32 > rather than plain int, so the pg_atomic_...() functions should be used > regardless the buffer is shared or local. Sorry for the noise. Right. I thought, though, tha

Re: Atomics in localbuf.c

2020-03-05 Thread Antonin Houska
Andres Freund wrote: > On March 5, 2020 12:42:06 PM PST, Antonin Houska wrote: > >Andres Freund wrote: > > > >> On March 5, 2020 9:21:55 AM PST, Antonin Houska > >wrote: > >> >What's the reason to use pg_atomic...read_...() and > >> >pg_atomic...write_...() > >> >functions in localbuf.c? > >>

Re: Atomics in localbuf.c

2020-03-05 Thread Andres Freund
Hi On March 5, 2020 12:42:06 PM PST, Antonin Houska wrote: >Andres Freund wrote: > >> On March 5, 2020 9:21:55 AM PST, Antonin Houska >wrote: >> >What's the reason to use pg_atomic...read_...() and >> >pg_atomic...write_...() >> >functions in localbuf.c? >> > >> >It looks like there was an inte

Re: Atomics in localbuf.c

2020-03-05 Thread Antonin Houska
Andres Freund wrote: > On March 5, 2020 9:21:55 AM PST, Antonin Houska wrote: > >What's the reason to use pg_atomic...read_...() and > >pg_atomic...write_...() > >functions in localbuf.c? > > > >It looks like there was an intention not to use them > > > >https://www.postgresql.org/message-id/CAP

Re: Atomics in localbuf.c

2020-03-05 Thread Andres Freund
Hi On March 5, 2020 9:21:55 AM PST, Antonin Houska wrote: >What's the reason to use pg_atomic...read_...() and >pg_atomic...write_...() >functions in localbuf.c? > >It looks like there was an intention not to use them > >https://www.postgresql.org/message-id/CAPpHfdtfr3Aj7xJonXaKR8iY2p8uXOQ%2Be4B

Atomics in localbuf.c

2020-03-05 Thread Antonin Houska
What's the reason to use pg_atomic...read_...() and pg_atomic...write_...() functions in localbuf.c? It looks like there was an intention not to use them https://www.postgresql.org/message-id/CAPpHfdtfr3Aj7xJonXaKR8iY2p8uXOQ%2Be4BMpMDAM_5R4OcaDA%40mail.gmail.com but the following discussion does