Re: AIO writes vs hint bits vs checksums

2024-11-19 Thread Andres Freund
Hi, On 2024-11-01 14:10:54 -0400, Andres Freund wrote: > I still don't like this idea a whole lot - but perhaps we could get reduce the > overhead of my proposal some, to get closer to yours. When setting hint bits > for many tuples on a page the overhead of my approach is neglegible, but when >

Re: AIO writes vs hint bits vs checksums

2024-11-01 Thread Andres Freund
Hi, On 2024-10-30 09:58:30 -0400, Andres Freund wrote: > On 2024-10-30 14:16:51 +0200, Heikki Linnakangas wrote: > > Could we put the overhead on the FlushBuffer() > > instead? > > > > How about something like this: > > > > To set hint bits: > > > > 1. Lock page in SHARED mode. > > 2. Read BM_IO_I

Re: AIO writes vs hint bits vs checksums

2024-10-30 Thread Heikki Linnakangas
On 24/09/2024 18:55, Andres Freund wrote: What I'd instead like to propose is to implement the right to set hint bits as a bit in each buffer's state, similar to BM_IO_IN_PROGRESS. Tentatively I named this BM_SETTING_HINTS. It's only allowed to set BM_SETTING_HINTS when BM_IO_IN_PROGRESS isn't al

Re: AIO writes vs hint bits vs checksums

2024-10-30 Thread Andres Freund
Hi, On 2024-10-30 10:47:35 -0700, Jeff Davis wrote: > On Tue, 2024-09-24 at 11:55 -0400, Andres Freund wrote: > > What I suspect we might want instead is something inbetween a share > > and an > > exclusive lock, which is taken while setting a hint bit and which > > conflicts > > with having an IO

Re: AIO writes vs hint bits vs checksums

2024-10-30 Thread Jeff Davis
On Tue, 2024-09-24 at 11:55 -0400, Andres Freund wrote: > What I suspect we might want instead is something inbetween a share > and an > exclusive lock, which is taken while setting a hint bit and which > conflicts > with having an IO in progress. I am starting to wonder if a shared content locks

Re: AIO writes vs hint bits vs checksums

2024-10-30 Thread Andres Freund
Hi, On 2024-10-30 13:29:01 +0200, Heikki Linnakangas wrote: > On 30/10/2024 04:21, Andres Freund wrote: > > Attached is a, unfortunately long, series of patches implementing what I > > described upthread. > > Review of the preparatory patches: > > > 0001 Add very basic test for kill_prior_tuples

Re: AIO writes vs hint bits vs checksums

2024-10-30 Thread Andres Freund
Hi, Thanks for the quick review! On 2024-10-30 14:16:51 +0200, Heikki Linnakangas wrote: > On 24/09/2024 18:55, Andres Freund wrote: > > What I'd instead like to propose is to implement the right to set hint bits > > as > > a bit in each buffer's state, similar to BM_IO_IN_PROGRESS. Tentatively

Re: AIO writes vs hint bits vs checksums

2024-10-30 Thread Heikki Linnakangas
On 30/10/2024 04:21, Andres Freund wrote: Attached is a, unfortunately long, series of patches implementing what I described upthread. Review of the preparatory patches: 0001 Add very basic test for kill_prior_tuples We currently don't exercise this patch for gist and hash, which seems

Re: AIO writes vs hint bits vs checksums

2024-10-29 Thread Andres Freund
Hi, Attached is a, unfortunately long, series of patches implementing what I described upthread. 0001 Add very basic test for kill_prior_tuples We currently don't exercise this patch for gist and hash, which seems somewhat criminal. 0002 heapam: Move logic to handle HEAP_MOVED into a

Re: AIO writes vs hint bits vs checksums

2024-09-26 Thread Thomas Munro
On Wed, Sep 25, 2024 at 12:45 PM Thomas Munro wrote: > On Wed, Sep 25, 2024 at 8:30 AM Andres Freund wrote: > > However, our habit of modifying buffers while IO is going on is > > causing issues with filesystem level checksums as well, as evidenced by the > > fact that debug_io_direct = data on b

Re: AIO writes vs hint bits vs checksums

2024-09-25 Thread Antonin Houska
Antonin Houska wrote: > Andres Freund wrote: > > > What I'd instead like to propose is to implement the right to set hint bits > > as > > a bit in each buffer's state, similar to BM_IO_IN_PROGRESS. Tentatively I > > named this BM_SETTING_HINTS. It's only allowed to set BM_SETTING_HINTS when >

Re: AIO writes vs hint bits vs checksums

2024-09-25 Thread Antonin Houska
Andres Freund wrote: > What I'd instead like to propose is to implement the right to set hint bits as > a bit in each buffer's state, similar to BM_IO_IN_PROGRESS. Tentatively I > named this BM_SETTING_HINTS. It's only allowed to set BM_SETTING_HINTS when > BM_IO_IN_PROGRESS isn't already set and

Re: AIO writes vs hint bits vs checksums

2024-09-24 Thread Noah Misch
On Tue, Sep 24, 2024 at 04:30:25PM -0400, Andres Freund wrote: > On 2024-09-24 12:43:40 -0700, Noah Misch wrote: > > On Tue, Sep 24, 2024 at 11:55:08AM -0400, Andres Freund wrote: > > > Besides that, the need to copy the buffers makes checkpoints with AIO > > > noticeably slower when checksums are

Re: AIO writes vs hint bits vs checksums

2024-09-24 Thread Thomas Munro
On Wed, Sep 25, 2024 at 8:30 AM Andres Freund wrote: > Just ran that. There probably is a performance difference, but it's small > (<0.5%) making it somewhat hard to be certain. It looks like the main reason > for that is ConditionVariableBroadcast() on the iocv shows up even though > nobody is wa

Re: AIO writes vs hint bits vs checksums

2024-09-24 Thread Andres Freund
Hi, On 2024-09-24 12:43:40 -0700, Noah Misch wrote: > On Tue, Sep 24, 2024 at 11:55:08AM -0400, Andres Freund wrote: > > So far the AIO patchset has solved this by introducing a set of "bounce > > buffers", which can be acquired and used as the source/target of IO when > > doing > > it in-place i

Re: AIO writes vs hint bits vs checksums

2024-09-24 Thread Noah Misch
On Tue, Sep 24, 2024 at 11:55:08AM -0400, Andres Freund wrote: > So far the AIO patchset has solved this by introducing a set of "bounce > buffers", which can be acquired and used as the source/target of IO when doing > it in-place into shared buffers isn't viable. > > I am worried about that solu

AIO writes vs hint bits vs checksums

2024-09-24 Thread Andres Freund
Hi, Currently we modify pages while just holding a share lock, for hint bit writes. Writing a buffer out only requires a share lock. Because of that we can't compute checksums and write out pages in-place, as a concurent hint bit write can easily corrupt the checksum. That's not great, but not aw