Re: including backend ID in relpath of temp rels - updated patch - Mailing list pgsql-hackers

From Robert Haas
Subject Re: including backend ID in relpath of temp rels - updated patch
Date
Msg-id AANLkTinmJYm_MSL4qWdgLinT99E=DusZj6fftNtsSHJ6@mail.gmail.com
Whole thread Raw
In response to Re: including backend ID in relpath of temp rels - updated patch  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: including backend ID in relpath of temp rels - updated patch
List pgsql-hackers
On Thu, Aug 12, 2010 at 7:04 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> One other thought about all this: in the past, one objection that's been
> raised to deleting files during crash restart is the possible loss of
> forensic evidence.  It might be a good idea to provide some fairly
> simple way for developers to disable that deletion subroutine.  I'm not
> sure that it rises to the level of needing a GUC, though.

See http://archives.postgresql.org/pgsql-hackers/2010-06/msg00622.php :

In this version of the patch, I've improved the temporary file cleanup
mechanism.  In CVS HEAD, when a transaction commits or aborts, we
write an XLOG record with all relations that must be unlinked,
including temporary relations.  With this patch, we no longer include
temporary relations in the XLOG records (which may be a tiny
performance benefit for some people); instead, on every startup of the
database cluster, we just nuke all temporary relation files (which is
now easy to do, since they are named differently than files for
non-temporary relations) at the same time that we nuke other temp
files.  This produces slightly different behavior.  In CVS HEAD,
temporary files get removed whenever an xlog redo happens, so either
at cluster start or after a backend crash, but only to the extent that
they appear in WAL.  With this patch, we can be sure of removing ALL
stray files, which is maybe ever-so-slightly leaky in CVS HEAD.  But
on the other hand, because it hooks into the existing temporary file
cleanup code, it only happens at cluster startup, NOT after a backend
crash.  The existing coding leaves temporary sort files and similar
around after a backend crash for forensics purposes.  That might or
might not be worth rethinking for non-debug builds, but I don't think
there's any very good reason to think that temporary relation files
need to be handled differently than temporary work files.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: RecordTransactionCommit() and SharedInvalidationMessages
Next
From: Fujii Masao
Date:
Subject: Re: typos in HS source code comment