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-development <pgsql-hackers(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 15:32:11
Message-ID: 200311171532.hAHFWB305530@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:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Where am I wrong?
>
> I don't think any of this is relevant. There are a certain number of
> blocks we have to get down to disk before we can declare a transaction
> committed, and there are a certain number that we have to get down to
> disk before we can declare a checkpoint complete. You are focusing too
> much on the question of whether a particular process performs an fsync
> operation, and ignoring the fact that ultimately it's got to wait for
> I/O to complete --- directly or indirectly. If it blocks waiting for
> some other process to declare a buffer clean, rather than writing for
> itself, what's the difference?
>
> Sure, fsync serializes the particular process that's doing it, but we
> can deal with that by spreading the fsyncs across multiple processes,
> and trying to ensure that they are mostly background processes rather
> than foreground ones.
>
> I don't claim that immediate-fsync-on-write is the only answer, but
> I cannot follow your reasoning for dimissing it out of hand ... and I
> certainly cannot buy *any* logic that says that sync() is a good answer
> to any of these issues. AFAICS sync() means that we abandon
> responsibility.

[ Discussion moved to hackers/win32.]

I was thinking about sync() --- one of its problems is that is schedules
writes to disk but returns before it is completed. If we do sync(),
then open, write, fsync, close a file, aren't we then pretty sure all
the scheduled sync writes have completed too? I know SCSI has tagged
queueing, but I figured creating a new file and writing/fsync would come
after the sync writes.

--
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-11-17 15:33:49 Re: [PATCHES] SRA Win32 sync() code
Previous Message Christopher Kings-Lynne 2003-11-17 14:34:51 commenting on polymorphic aggregates possible?

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Bruce Momjian 2003-11-17 15:33:49 Re: [PATCHES] SRA Win32 sync() code
Previous Message Merlin Moncure 2003-11-17 14:28:22 Re: [PATCHES] SRA Win32 sync() code

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2003-11-17 15:33:49 Re: [PATCHES] SRA Win32 sync() code
Previous Message Hannu Krosing 2003-11-17 10:28:34 Re: [PATCHES] SRA Win32 sync() code