Re: Temporary tables prevent autovacuum, leading to XID wraparound

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org, "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, "tgl(at)sss(dot)pgh(dot)pa(dot)us" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "robertmhaas(at)gmail(dot)com" <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Temporary tables prevent autovacuum, leading to XID wraparound
Date: 2018-08-14 16:53:32
Message-ID: 20180814165332.GB5316@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
temp-namespace-comments-2.patch text/x-diff 2.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2018-08-14 16:55:37 [patch] Duplicated pq_sendfloat4/8 prototypes
Previous Message Michael Paquier 2018-08-14 16:23:57 Re: Temporary tables prevent autovacuum, leading to XID wraparound