Re: Temporary tables prevent autovacuum, leading to XID wraparound - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Temporary tables prevent autovacuum, leading to XID wraparound
Date
Msg-id 20180814165332.GB5316@paquier.xyz
Whole thread Raw
In response to Re: Temporary tables prevent autovacuum, leading to XID wraparound  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: Temporary tables prevent autovacuum, leading to XID wraparound
List pgsql-hackers
On Mon, Aug 13, 2018 at 01:53:18PM -0300, Alvaro Herrera wrote:
> I do share Andres' concerns on the wording the comment.  I would say
> something like
>
> /*
>  * Reset the temporary namespace flag in MyProc.  We assume this to be
>  * an atomic assignment.
>  *
>  * Because this subtransaction is rolling back, the pg_namespace
>  * row is not visible to anyone else anyway, but that doesn't matter:
>  * it's not a problem if objects contained in this namespace are removed
>  * concurrently.
>  */

> The fact of assignment being atomic and the fact of the pg_namespace row
> being visible are separately important.  You care about it being atomic
> because it means you must not have someone read "16" (0x10) when you
> were partway removing the value "65552" (0x10010), thus causing that
> someone removing namespace 16.  And you care about the visibility of the
> pg_namespace row because of whether you're worried about a third party
> removing the tables from that namespace or not: since the subxact is
> aborting, you are not.

I was thinking about adding "Even if it is not atomic" or such at the
beginning of the paragraph, but at the end your phrasing sounds better
to me.  So I have hacked up the attached, which also reworks the comment
in InitTempTableNamespace in the same spirit.  Thoughts?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Temporary tables prevent autovacuum, leading to XID wraparound
Next
From: Christoph Berg
Date:
Subject: [patch] Duplicated pq_sendfloat4/8 prototypes