pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Have DISCARD ALL/TEMP remove leftover temp tables
Date: Thu, 27 Dec 2018 19:20:09 +0000
Message-ID: <E1gcbCT-0001LV-QN@gemulon.postgresql.org> (raw)

Have DISCARD ALL/TEMP remove leftover temp tables

Previously, it would only remove temp tables created in the same
session; but if the session uses the BackendId of a previously crashed
backend that left temp tables around, those would not get removed.
Since autovacuum would not drop them either (because it sees that the
BackendId is in use by the current session) these can cause annoying
xid-wraparound warnings.

Apply to branches 9.4 to 10.  This is not a problem since version 11,
because commit 943576bddcb5 added state tracking that makes autovacuum
realize that those temp tables are not ours, so it removes them.

This is useful to handle in DISCARD, because even though it does not
handle all situations, it does handle the common one where a connection
pooler keeps the same session open for an indefinitely long time.

Discussion: https://postgr.es/m/20181226190834.wsk2wzott5yzrjiq@alvherre.pgsql
Reviewed-by: Takayuki Tsunakawa, Michaƫl Paquier

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3c4ca21093b5d0662389777df853f6f3a36ee476

Modified Files
--------------
src/backend/catalog/namespace.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)



view thread (4+ messages)  latest in thread

Message-ID: <E1gcbCT-0001LV-QN@gemulon.postgresql.org>
Permalink:  ../E1gcbCT-0001LV-QN@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1gcbCT-0001LV-QN@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Have DISCARD ALL/TEMP remove leftover temp tables
  In-Reply-To: <E1gcbCT-0001LV-QN@gemulon.postgresql.org>
  References: <E1gcbCT-0001LV-QN@gemulon.postgresql.org>

* 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