Re: smgrsettransient mechanism is full of bugs - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: smgrsettransient mechanism is full of bugs
Date
Msg-id 20121016193941.GA10361@alvh.no-ip.org
Whole thread Raw
In response to smgrsettransient mechanism is full of bugs  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:

> After further review, I have become convinced that in fact it's
> completely broken and needs to be redone from scratch.  The temp-file
> marking at the fd.c level can easily get out of sync with the marking
> at the smgr level, and that marking isn't too consistent with reality
> either, which means we have all of the following problems:

Oops.  Sorry about this.  Fortunately, as far as I can see, it only
results in excessive resource consumption, not data corruption or loss.

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

Makes sense.  It does seem simpler than the original approach.

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: "Stafford, David x78061"
Date:
Subject: Re: Truncate if exists
Next
From: Alvaro Herrera
Date:
Subject: Re: embedded list