Re: ALTER DATABASE SET TABLESPACE vs crash safety

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org, Guillaume Lelarge <guillaume(at)lelarge(dot)info>, Bernd Helmle <mailings(at)oopsware(dot)de>
Subject: Re: ALTER DATABASE SET TABLESPACE vs crash safety
Date: 2008-11-07 15:59:49
Message-ID: 20081107155949.GC5507@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:

> That is, that's true as long as the filesystem copy in fact pushed
> everything to disk. copydir() does an fsync() on each file it copies,
> so I think we have done as much as we can to protect the data being
> copied, but I wonder if anyone feels it's too dangerous?

Do we need to fsync the directory itself? My fsync(2) manpage says

Calling fsync() does not necessarily ensure that the entry in the directory
containing the file has also reached disk. For that an explicit fsync() on a
file descriptor for the directory is also needed.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martin Pihlak 2008-11-07 16:03:40 Re: auto_explain contrib moudle
Previous Message Tom Lane 2008-11-07 15:53:59 ALTER DATABASE SET TABLESPACE vs crash safety