

> -----Original Message-----
> From: Tatsuo Ishii [mailto:t-ishii@sra.co.jp] 
> Sent: 06 March 2003 14:00
> To: Dave Page
> Cc: pgsql-hackers@postgresql.org
> Subject: Re: [HACKERS] Win32 Powerfail testing
> 
> 
> > > Sorry, but it does not help. The page says we could use
> > > FlushFileBuffers() to sync the kernel buffer to the
> > > disk. Unfortunately, it requires a file descriptor to flush
> > > for its argument. Thus it could not be a replacement of 
> > > sync(). Actually I have modified the buffer manager so that 
> > > it remembers all file descriptors those have not been synced 
> > > yet to the disk at the checkpoint time to sync them later. 
> > > However I found this modification does not help at all with 
> > > some reason I don't know.
> > 
> > How do you open the files (function, flags etc)?
> 
> Are you asking the way how to open files in the buffer 
> manager? If so, basically PostgreSQL uses open() with flags 
> (O_RDWR | PG_BINARY, 0600).

I cannot find it now, but I'm sure I read that FlushFileBuffers() has no
effect unless the file was opened with CreateFile() with the
GENERIC_WRITE flag. A quick google shows quite a few people recommending
that approach to others having trouble flushing files opened with fopen
or _open.

Regards, Dave.

Thu, 6 Mar 2003 14:54:25 -0000
"Dave Page" <dpage@vale-housing.co.uk>
Re: Win32 Powerfail testing
> > Are you asking the way how to open files in the buffer 
> > manager? If so, basically PostgreSQL uses open() with flags 
> > (O_RDWR | PG_BINARY, 0600).
> 
> I cannot find it now, but I'm sure I read that FlushFileBuffers() has no
> effect unless the file was opened with CreateFile() with the
> GENERIC_WRITE flag. A quick google shows quite a few people recommending
> that approach to others having trouble flushing files opened with fopen
> or _open.

I'm sure FlushFileBuffers() is usesless for files opend with open()
too. 

As I said in the previlus mails, open()+_commit() does the right job
with the transaction log files. So probably I think I should stick
with open()+_commit() approach for ordinary table/index files too.
--
Tatsuo Ishii

Fri, 07 Mar 2003 00:16:41 +0900 (JST)
Tatsuo Ishii <t-ishii@sra.co.jp>
Re: Win32 Powerfail testing