pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Mahendra Singh Thalor <mahi6run@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Assert failure due to "drop schema pg_temp_3 cascade" for temporary tables and \d+ is not showing any info after drooping temp table schema
Date: Sat, 11 Jan 2020 09:03:23 +0900
Message-ID: <20200111000323.GF250447@paquier.xyz> (raw)
In-Reply-To: <27335.1578667858@sss.pgh.pa.us>
References: <CA+TgmoYCd6gaCy2-YzO5DyR=YFxRAbKaC5ucL9DL4jSnTgs14A@mail.gmail.com>
	<14868.1578420368@sss.pgh.pa.us>
	<20200108004409.GA3413@paquier.xyz>
	<5602.1578444917@sss.pgh.pa.us>
	<20200108015601.GB3413@paquier.xyz>
	<20200109040612.GG2251@paquier.xyz>
	<CAKYtNArmm0f4zYHebpQ9kf7LOJeiuexKSnnmhiOiLQc3_F39ug@mail.gmail.com>
	<20200110080125.GA250447@paquier.xyz>
	<20200110110748.GD250447@paquier.xyz>
	<27335.1578667858@sss.pgh.pa.us>

On Fri, Jan 10, 2020 at 09:50:58AM -0500, Tom Lane wrote:
> This doesn't seem like a very good idea to me.  Is there any
> evidence that it's fixing an actual problem?  What if the table
> you're skipping is holding back datfrozenxid?

That's the point I wanted to make sure: we don't because autovacuum
has never actually been able to do that and because the cluster is
put in this state by a superuser after issuing DROP SCHEMA on its
temporary schema, which allows many fancy things based on the
inconsistent state the session is on.  Please see see for example
REL_10_STABLE where GetTempNamespaceBackendId() would return
InvalidBackendId when the namespace does not exist, so the drop is
skipped.  246a6c8 (designed to track if a backend slot is using a temp
namespace or not, allowing cleanup of orphaned tables if the namespace
is around, still not used yet by the session it is assigned to) has
changed the logic, accidentally actually, to also allow an orphaned
temp table to be dropped even if its namespace does not exist
anymore.

If we say that it's fine for autovacuum to allow the drop of such
inconsistent pg_class entries, then we would need to either remove or
relax the assertion in relcache.c:1123 (RelationBuildDesc, should only
autovacuum be allowed to do so?) to begin to allow autovacuum to
remove temp relations.  However, this does not sound like a correct
thing to do IMO.  So, note that if autovacuum is allowed to do so, you
basically defeat partially the purpose of the assertion added by
debcec7d in relcache.c.  Another thing noticeable is that If
autovacuum does the pg_class entry drops, the on-disk files for the
temp relations would remain until the cluster is restarted by the
way.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (37+ messages)  latest in thread

Message-ID: <20200111000323.GF250447@paquier.xyz>
Permalink:  ../20200111000323.GF250447@paquier.xyz/
Also on:    postgresql.org/message-id/20200111000323.GF250447@paquier.xyz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: michael@paquier.xyz, tgl@sss.pgh.pa.us, mahi6run@gmail.com, robertmhaas@gmail.com, horikyota.ntt@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Assert failure due to "drop schema pg_temp_3 cascade" for temporary tables and \d+ is not showing any info after drooping temp table schema
  In-Reply-To: <20200111000323.GF250447@paquier.xyz>
  References: <CA+TgmoYCd6gaCy2-YzO5DyR=YFxRAbKaC5ucL9DL4jSnTgs14A@mail.gmail.com> <14868.1578420368@sss.pgh.pa.us> <20200108004409.GA3413@paquier.xyz> <5602.1578444917@sss.pgh.pa.us> <20200108015601.GB3413@paquier.xyz> <20200109040612.GG2251@paquier.xyz> <CAKYtNArmm0f4zYHebpQ9kf7LOJeiuexKSnnmhiOiLQc3_F39ug@mail.gmail.com> <20200110080125.GA250447@paquier.xyz> <20200110110748.GD250447@paquier.xyz> <27335.1578667858@sss.pgh.pa.us> <20200111000323.GF250447@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox