Re: Directory fsync and other fun - Mailing list pgsql-hackers

From Takahiro Itagaki
Subject Re: Directory fsync and other fun
Date
Msg-id 20100224115107.9738.52131E4D@oss.ntt.co.jp
Whole thread Raw
In response to Directory fsync and other fun  (Andres Freund <andres@anarazel.de>)
Responses Re: Directory fsync and other fun  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Directory fsync and other fun  (Greg Stark <gsstark@mit.edu>)
List pgsql-hackers
Andres Freund <andres@anarazel.de> wrote:

> I started setting up some halfway automated method of simulating hard crashes 
> and even while setting those up I found some pretty unsettling results...
> Now its not unlikely that my testing is flawed but unfortunately I don't see 
> where right now (its 3am now and I have a 8h trainride behind me, so ...)

I think the reported behavior is a TODO item to research:
* Research use of fsync to a newly created directory.  There is no guarantee that mkdir() flushes metadata of the
directory.

Also, I heard ext4 has a "feature" in that rename() might truncate the
renamed file to zero bytes on crash. The user data in the file might be
lost if the machine crashes just after rename().
* Research whether our use of rename() is safe on various file systems.  Especially on ext4, the contents of the
renamedfile might be lost on crash.
 

Comments and suggestion for improvements of words welcome.
If no objection, I'll add them at the Fsync section in the TODO page.

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCH] 8.5 TODO: Add comments to output indicating version of pg_dump and of the database server
Next
From: Tom Lane
Date:
Subject: Re: Directory fsync and other fun