Skip site navigation (1) Skip section navigation (2)

fsync with sync, and Win32 unlink

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Cc: PostgreSQL Win32 port list <pgsql-hackers-win32(at)postgreSQL(dot)org>
Subject: fsync with sync, and Win32 unlink
Date: 2004-03-10 22:56:07
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-hackers-win32
I have talked to Tom today and he is willing to implement the discussed
method of doing fsync on every file modified between checkpoints, and
add unlink handling for open files for Win32.

Here are the implementation details:

1)  Create a list in shared memory that holds a fixed number of dirty
files and files that win32 can't delete because they are open.

The list will need to be locked for each insertion. Periodially, the
background writer will lock and empty the list and store it in its own
local memory.  Each entry will contain dbid, relfilenode, and the offset
of extent number of the file.  As an optimization, inserts will check to
see if the previous entry already matches.

2)  Checkpoint behavior will be moved into the background writer.

3)  On checkpoint request, either by the user or postmaster, the
background writer will create a subprocess, do a sync(), wait, then do
fsync of all files that were marked as dirty.  The sync() should flush
out most of the dirty files in an optimal manner.

4)  Losing the shared memory list of delete files during a crash will
not be a problem.  In case of a crash, the WAL logs contain information
about deleted files (new in 7.5), and those files will be delete on

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

pgsql-hackers by date

Next:From: Tom LaneDate: 2004-03-10 22:56:18
Subject: Re: unsafe floats
Previous:From: Tom LaneDate: 2004-03-10 22:47:43
Subject: Re: unsafe floats

pgsql-hackers-win32 by date

Next:From: Bruce MomjianDate: 2004-03-11 04:06:59
Subject: Timezone support
Previous:From: Claudio NatoliDate: 2004-03-09 01:08:34
Subject: Re: Win32 regression test status

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group