Re: [PATCHES] SRA Win32 sync() code

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>, PostgreSQL Win32 port list <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: [PATCHES] SRA Win32 sync() code
Date: 2003-11-17 05:46:34
Message-ID: 200311170546.hAH5kYn17867@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-hackers-win32 pgsql-patches

Tom Lane wrote:
> > Do we know that having the background writer fsync a file that was
> > written by a backend cause all the data to fsync? I think I could write
> > a program to test this by timing each of these tests:
>
> That might prove something about the particular platform you tested it
> on; but it would not speak to the real problem, which is what we can
> assume is true on every platform...

The attached program does test if fsync can be used on a file descriptor
after the file is closed and then reopened. I see:

write 0.000613
write & fsync 0.001727
write, close & fsync 0.001633

This shows that fsync works even after the file is closed and reopened.
I could test by writing using a subprocess, but I don't see how that
would be different, and it would mess up my timings.

Anyway, if we find all our platforms can pass this test, we might be
able to allow backends to do their own writes and just record the file
name somewhere for the checkpointer to fsync. It also shows write/fsync
was 3x slower than simple write.

Does anyone have a platform where the last duration is significantly
different from the middle timing?

I am keeping this discussion on patches because of the C program
attachment.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 2.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2003-11-17 06:11:53 Re: start of transaction (was: Re: [PERFORM] Help with count(*))
Previous Message Bruce Momjian 2003-11-17 04:33:46 Re: [PATCHES] SRA Win32 sync() code

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Shridhar Daithankar 2003-11-17 08:15:49 Re: [pgsql-hackers-win32] SRA Win32 sync() code
Previous Message Bruce Momjian 2003-11-17 04:33:46 Re: [PATCHES] SRA Win32 sync() code

Browse pgsql-patches by date

  From Date Subject
Next Message Manfred Spraul 2003-11-17 06:33:12 Re: SIGPIPE handling
Previous Message Bruce Momjian 2003-11-17 04:33:46 Re: [PATCHES] SRA Win32 sync() code