Re: Pre-allocating WAL files - Mailing list pgsql-hackers

From Bossart, Nathan
Subject Re: Pre-allocating WAL files
Date
Msg-id 96E4FEA2-331C-46DF-8F78-6F8B86FD2142@amazon.com
Whole thread Raw
In response to Re: Pre-allocating WAL files  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Responses Re: Pre-allocating WAL files  ("Bossart, Nathan" <bossartn@amazon.com>)
List pgsql-hackers
On 12/7/21, 12:29 AM, "Bharath Rupireddy" <bharath.rupireddyforpostgres@gmail.com> wrote:
> Why can't the walwriter pre-allocate some of the WAL segments instead
> of a new background process? Of course, it might delay the main
> functionality of the walwriter i.e. flush and sync the WAL files, but
> having checkpointer do the pre-allocation makes it do another extra
> task. Here the amount of walwriter work vs checkpointer work, I'm not
> sure which one does more work compared to the other.

The argument against adding it to the WAL writer is that we want it to
run with low latency to flush asynchronous commits.  If we added WAL
pre-allocation to the WAL writer, there could periodically be large
delays.

> Another idea could be to let walwrtier or checkpointer pre-allocate
> the WAL files whichever seems free as-of-the-moment when the WAL
> segment pre-allocation request comes. We can go further to let the
> user choose which process i.e. checkpointer or walwrtier do the
> pre-allocation with a GUC maybe?

My latest patch set [0] adds WAL pre-allocation to the checkpointer.
In that patch set, WAL pre-allocation is done both outside of
checkpoints as well as during checkpoints (via
CheckPointWriteDelay()).  

Nathan

[0] https://www.postgresql.org/message-id/CB15BEBD-98FC-4E72-86AE-513D34014176%40amazon.com


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: ExecTypeSetColNames is fundamentally broken
Next
From: Tom Lane
Date:
Subject: Re: pg_dump versus ancient server versions