Skip site navigation (1) Skip section navigation (2)

Re: [COMMITTERS] Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <stark(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after
Date: 2010-02-23 05:37:26
Message-ID: 10494.1266903446@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-committerspgsql-hackers
I wrote:
> Any theories about what is happening?

Hah --- the AIX failures, at least, are explained at
http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.basetechref/doc/basetrf1/fsync.htm
which says

Error Codes

The fsync or fsync_range subroutine is unsuccessful if one or more of the following are true:

EIO	 An I/O error occurred while reading from or writing to the file system.
EBADF	 The FileDescriptor parameter is not a valid file descriptor open for writing.
EINVAL	 The file is not a regular file.
EINTR	 The subroutine was interrupted by a signal.

So the problem is that fsync_fname is trying to fsync a file it's opened
O_RDONLY.  I don't know whether Windows is similarly picky, but we'll
soon find out.

Now, this doesn't mean that all is fine and dandy.  I believe that a
majority of Unixen will reject attempts to open directories for writing,
so this solution puts us even further away from being able to fsync the
directories.  I would bet however that the platforms that reject this
are ones that don't need fsync on directories.  Maybe we just have to
have two different code paths depending on platform :-(

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2010-02-23 05:43:17
Subject: Re: Adding \ev view editor?
Previous:From: Bruce MomjianDate: 2010-02-23 05:22:03
Subject: Re: More robust pg_hba.conf parsing/error logging

pgsql-committers by date

Next:From: Tom LaneDate: 2010-02-23 05:44:55
Subject: pgsql: Some platforms reject fsync() on files opened O_RDONLY.
Previous:From: Bruce MomjianDate: 2010-02-23 05:17:33
Subject: pgsql: Make documentation more direct about the handling of COPY files

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group