Re: File leak?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: File leak?
Date: 2004-06-13 23:43:20
Message-ID: 200406132343.i5DNhKF24799@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Heikki Linnakangas <hlinnaka(at)iki(dot)fi> writes:
> > On Sat, 12 Jun 2004, Tom Lane wrote:
> >> Heikki Linnakangas <hlinnaka(at)iki(dot)fi> writes:
> >>> I wonder if we could clean up those lost files on database recovery or
> >>> vacuum.
> >>
> >> There is a TODO for this, but it seems exceedingly low priority to me.
>
> > Are you sure? I read through the TODO list but couldn't find it.
>
> Well, there used to be: 7.4 TODO has
>
> * Remove unreferenced table files and temp tables during database vacuum
> or postmaster startup (Bruce)
>
> Now that I think about it, I believe Bruce recently removed this on my
> advice; I was thinking that the problem shouldn't occur anymore now that

True.

> we WAL-log file creation and deletion. But actually the present form of
> the WAL entries doesn't ensure that a file created by a transaction that
> crashes before committing will go away, because file deletion actions
> are only logged (and replayed) at transaction commit/abort. So it
> probably should go back in. Or else we could add more WAL logging

Wording updated to:

* Remove unreferenced table files created by a transactions that were
in-progress when the server crashed

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

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-06-13 23:47:22 Re: File leak?
Previous Message Tom Lane 2004-06-13 23:22:35 Re: Can get GiST RECHECK clause to work