pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Andy Fan <zhihuifan1213@163.com>
Cc: Justin Pryzby <pryzby@telsasoft.com>
Cc: Maxim Orlov <orlovmg@gmail.com>
Cc: Pavel Borisov <pashkin.elfe@gmail.com>
Cc: Bossart, Nathan <bossartn@amazon.com>
Cc: Maxim Orlov <m.orlov@postgrespro.ru>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Pre-allocating WAL files
Date: Wed, 22 Jan 2025 11:43:20 -0600
Message-ID: <Z5EuOBav0sc_vG9c@nathan> (raw)
In-Reply-To: <745zvagaf6tfn2zbvtmqvxsr6kmybjbzcw6rsm55jnql4233je@tudeipoewruo>
References: <20220301144044.GG25269@telsasoft.com>
	<20220301150704.GA1030078@nathanxps13>
	<20220317231212.GB1415284@nathanxps13>
	<20220408203003.GA1630183@nathanxps13>
	<87sepc4zcg.fsf@163.com>
	<Z4_C04ZJ_SymvYes@nathan>
	<Z4_Hmj2R8NXnAI-K@nathan>
	<vfhyldq3rtnwd4uxbb7ro2opmvbmfswvkycavmzcqb55mmo4jk@g2d2n6xnwicb>
	<87o6zz4pld.fsf@163.com>
	<745zvagaf6tfn2zbvtmqvxsr6kmybjbzcw6rsm55jnql4233je@tudeipoewruo>

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





view thread (36+ messages)  latest in thread

Message-ID: <Z5EuOBav0sc_vG9c@nathan>
Permalink:  ../Z5EuOBav0sc_vG9c@nathan/
Also on:    postgresql.org/message-id/Z5EuOBav0sc_vG9c@nathan

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: nathandbossart@gmail.com, andres@anarazel.de, zhihuifan1213@163.com, pryzby@telsasoft.com, orlovmg@gmail.com, pashkin.elfe@gmail.com, bossartn@amazon.com, m.orlov@postgrespro.ru, pgsql-hackers@lists.postgresql.org
  Subject: Re: Pre-allocating WAL files
  In-Reply-To: <Z5EuOBav0sc_vG9c@nathan>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox