Re: [PATCHES] SRA Win32 sync() code

From: "Steve Tibbett" <stevex(at)stevex(dot)org>
To:
Cc: "'PostgreSQL Win32 port list'" <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: [PATCHES] SRA Win32 sync() code
Date: 2003-11-20 00:35:03
Message-ID: 3F61636001D91D89@mta3.wss.scd.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-hackers-win32 pgsql-patches

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

Sorry to jump in in the middle of this but I'm just wondering if some of the
Win32 file creation flags might help out here.. if the problem is figuring
out how to flush stuff to the disk, what about using FILE_FLAG_NO_BUFFERING?
I'm not sure how you'd create a stdio FILE with custom CreateFile flags but
there's probably a way, I can see if I can figure it out if it looks like it
would be useful.

There are quite a few flags that are Win32 specific but that might help for
various things, like..

FILE_FLAG_DELETE_ON_CLOSE (you can't delete a file while it's open, but you
can open it specifying that it go away when you close it, in the case where
you know it's a temp file).

FILE_ATTRIBUTE_TEMPORARY (an optimization that hints to the filesystem that
this is a temporary file so don't bother writing it to disk (keep it in the
cache) unless you need to).

FILE_FLAG_WRITE_THROUGH (kinda like FILE_FLAG_NO_BUFFERING but different..
the SDK docs describe how they interact).

- Steve

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-11-20 01:17:29 Re: Is there going to be a port to Solaris 9 x86 in the
Previous Message Peter Eisentraut 2003-11-19 23:42:58 Re: Build farm

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Claudio Natoli 2003-11-27 08:46:32 Re: fork/exec
Previous Message Manfred Spraul 2003-11-19 21:07:57 Re: [pgsql-hackers-win32] SRA Win32 sync() code

Browse pgsql-patches by date

  From Date Subject
Next Message ViSolve Open Source Team 2003-11-20 00:55:26 (Modified) Patch request for PostgreSQL 7.4 for HP-UX IA-64
Previous Message Euler Taveira de Oliveira 2003-11-20 00:09:20 internationalization of initdb