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

From Nathan Bossart
Subject Re: Pre-allocating WAL files
Date
Msg-id Z5EuOBav0sc_vG9c@nathan
Whole thread Raw
In response to Re: Pre-allocating WAL files  (Andres Freund <andres@anarazel.de>)
Responses Re: Pre-allocating WAL files
List pgsql-hackers
On Wed, Jan 22, 2025 at 11:21:03AM -0500, Andres Freund wrote:
> fsync(open(oldname1));
> fsync(open(oldname2));
> ..
> fsync(open(oldnameN));
> 
> rename(oldname1, newname1);
> rename(oldname2, newname2);
> ..
> rename(oldnameN, newnameN);
> 
> fsync(open(newname1));
> fsync(open(newname2));
> ..
> fsync(open(newnameN));
> 
> fsync(open("pg_wal"));

What is the purpose of syncing the file before the rename?

-- 
nathan



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Converting pqsignal to void return
Next
From: Paul Ramsey
Date:
Subject: Re: Converting pqsignal to void return