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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-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

Browse pgsql-committers by date

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

Browse pgsql-hackers by date

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