pgsql: Have DISCARD ALL/TEMP remove leftover temp tables - Mailing list pgsql-committers

From Alvaro Herrera
Subject pgsql: Have DISCARD ALL/TEMP remove leftover temp tables
Date
Msg-id E1gcbCT-0001LZ-Qd@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b7258a30aa6f1d4b53491174f372df07c5a6cd97

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


pgsql-committers by date:

Previous
From: Alvaro Herrera
Date:
Subject: pgsql: Make autovacuum more selective about temp tables to keep
Next
From: Alexander Korotkov
Date:
Subject: pgsql: Reduce length of GIN predicate locking isolation test suite