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: 200403102256.i2AMu7b14062@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-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
recovery.

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

Browse pgsql-hackers by date

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

Browse pgsql-hackers-win32 by date

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