Re: smgrsettransient mechanism is full of bugs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: smgrsettransient mechanism is full of bugs
Date: 2012-10-15 19:38:50
Message-ID: 3832.1350329930@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> I got a bit suspicious of the transient-file mechanism introduced in
> commit fba105b1099f4f5fa7283bb17cba6fed2baa8d0c after noticing that
> ...
> I believe that we probably ought to revert this mechanism entirely, and
> build a new implementation based on these concepts:
> * An SMgrRelation is transient if and only if it doesn't have an
> "owning" relcache entry. Keep a list of all such SmgrRelations, and
> close them all at transaction end. (Obviously, an SMgrRelation gets
> removed from the list if it acquires an owner mid-transaction.)
> * There's no such concept as FD_XACT_TRANSIENT at the fd.c level.
> Rather, we close and delete the VFD entry when told to by SmgrRelation
> closure.

Attached is a draft patch for that, presented in two parts: the first
part just reverts commit fba105b1099f4f5fa7283bb17cba6fed2baa8d0c,
and the second part installs the new mechanism. I'm reasonably pleased
with the way this turned out; I think it's cleaner as well as more
reliable than the previous patch.

The list-management code could possibly be replaced with slist once that
patch goes in, but since this needs to be back-patched, I didn't
consider that for the moment.

Comments?

regards, tom lane

Attachment Content-Type Size
revert-transient-fds.c text/x-patch 12.2 KB
add-transient-smgrrelations.c text/x-patch 9.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Browne 2012-10-15 19:39:45 Re: Potential autovacuum optimization: new tables
Previous Message Dimitri Fontaine 2012-10-15 19:35:26 Re: Truncate if exists