Re: File leak? - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: File leak?
Date
Msg-id Pine.OSF.4.58.0406140916001.175132@kosh.hut.fi
Whole thread Raw
In response to Re: File leak?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: File leak?
List pgsql-hackers
On Sun, 13 Jun 2004, Tom Lane wrote:

> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> >> (viz, log at the instant of file creation, and the replayer would have
> >> to keep track of whether it sees the creating transaction commit and
> >> delete the file if not).
>
> > I don't see how we could WAL log it because we don't fsync the WAL until
> > our transaction completes, right, or are you thinking we would do a
> > special fsync when we add the record?
>
> Right, we would have to XLogFlush the file-creation WAL record before we
> could actually create the file.  This is in line with the standard WAL
> rule: the WAL record must hit disk before the data file change it
> describes does.  Assuming that the filesystem fsync's the created inode
> immediately, that means we have to flush first.

I'm afraid that's not enough. Checkpoints spoil it, think:

1. CREATE TABLE foobar ...
2. INSERT ....
3. <checkpoint>
4. <crash>

The replay would not see the file-creation WAL record.

We need some additional stash for the pending file-creations to make them
survive checkpoints.

> I'm not sure what the performance implications of this would be; it's
> likely that pushing the cost somewhere else would be better.

I don't think that file creation is that common for it to matter..

- Heikki



pgsql-hackers by date:

Previous
From: Manfred Spraul
Date:
Subject: Re: [PATCHES] Compiling libpq with VisualC
Next
From: Peter Eisentraut
Date:
Subject: Re: Releasing 7.4.3 ...