Re: DSA_ALLOC_NO_OOM doesn't work

2024-02-21 Thread Robert Haas
On Thu, Feb 22, 2024 at 12:49 AM Heikki Linnakangas wrote: > That's fair, I can see those reasons. Nevertheless, I do think it was a > bad tradeoff. A little bit of repetition would be better here, or we can > extract the common parts to smaller functions. > > I came up with the attached: > >2

Re: DSA_ALLOC_NO_OOM doesn't work

2024-02-21 Thread Heikki Linnakangas
On 22/02/2024 01:03, Thomas Munro wrote: On Thu, Feb 22, 2024 at 10:30 AM Thomas Munro wrote: collisions arbitrarily far apart (just decide how many bits to use). . o O ( Perhaps if you also allocated slots using a FIFO freelist, instead of the current linear search for the first free slot, y

Re: DSA_ALLOC_NO_OOM doesn't work

2024-02-21 Thread Thomas Munro
On Thu, Feb 22, 2024 at 10:30 AM Thomas Munro wrote: > collisions arbitrarily far apart (just decide how many bits to use). . o O ( Perhaps if you also allocated slots using a FIFO freelist, instead of the current linear search for the first free slot, you could maximise the time before a slot is

Re: DSA_ALLOC_NO_OOM doesn't work

2024-02-21 Thread Thomas Munro
On Thu, Feb 22, 2024 at 8:19 AM Heikki Linnakangas wrote: > - Separate dsm_handle, used by backend code to interact with the high > level interface in dsm.c, from dsm_impl_handle, which is used to > interact with the low-level functions in dsm_impl.c. This gets rid of > the convention in dsm.c of

Re: DSA_ALLOC_NO_OOM doesn't work

2024-02-13 Thread Robert Haas
On Tue, Feb 13, 2024 at 7:53 PM Heikki Linnakangas wrote: > However, I must say that the dsm_impl_op() interface is absolutely > insane. It's like someone looked at ioctl() and thought, "hey that's a > great idea!". As the person who wrote that code, this made me laugh. I agree it's not the pret

Re: DSA_ALLOC_NO_OOM doesn't work

2024-02-13 Thread Thomas Munro
On Wed, Feb 14, 2024 at 3:23 AM Heikki Linnakangas wrote: > On 29/01/2024 14:06, Heikki Linnakangas wrote: > > If you call dsa_allocate_extended(DSA_ALLOC_NO_OOM), it will still > > ereport an error if you run out of space (originally reported at [0]). > > > > Attached patch adds code to test_dsa.

Re: DSA_ALLOC_NO_OOM doesn't work

2024-02-13 Thread Heikki Linnakangas
(moving to pgsql-hackers) On 29/01/2024 14:06, Heikki Linnakangas wrote: If you call dsa_allocate_extended(DSA_ALLOC_NO_OOM), it will still ereport an error if you run out of space (originally reported at [0]). Attached patch adds code to test_dsa.c to demonstrate that: postgres=# select test_