pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove temporary files after backend crash
Date: Thu, 18 Mar 2021 16:39:05 +0000
Message-ID: <E1lMvft-0006he-Iw@gemulon.postgresql.org> (raw)

Remove temporary files after backend crash

After a crash of a backend using temporary files, the files used to be
left behind, on the basis that it might be useful for debugging. But we
don't have any reports of anyone actually doing that, and it means the
disk usage may grow over time due to repeated backend failures (possibly
even hitting ENOSPC). So this behavior is a bit unfortunate, and fixing
it required either manual cleanup (deleting files, which is error-prone)
or restart of the instance (i.e. service disruption).

This implements automatic cleanup of temporary files, controled by a new
GUC remove_temp_files_after_crash. By default the files are removed, but
it can be disabled to restore the old behavior if needed.

Author: Euler Taveira
Reviewed-by: Tomas Vondra, Michael Paquier, Anastasia Lubennikova, Thomas Munro
Discussion: https://postgr.es/m/CAH503wDKdYzyq7U-QJqGn%3DGm6XmoK%2B6_6xTJ-Yn5WSvoHLY1Ww%40mail.gmail.com

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/config.sgml                      |  17 +++
src/backend/postmaster/postmaster.c           |   5 +
src/backend/storage/file/fd.c                 |  12 +-
src/backend/utils/misc/guc.c                  |   9 ++
src/backend/utils/misc/postgresql.conf.sample |   2 +
src/include/postmaster/postmaster.h           |   1 +
src/test/recovery/t/022_crash_temp_files.pl   | 192 ++++++++++++++++++++++++++
7 files changed, 233 insertions(+), 5 deletions(-)



Message-ID: <E1lMvft-0006he-Iw@gemulon.postgresql.org>
Permalink:  ../E1lMvft-0006he-Iw@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lMvft-0006he-Iw@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: tomas.vondra@postgresql.org
  Subject: Re: pgsql: Remove temporary files after backend crash
  In-Reply-To: <E1lMvft-0006he-Iw@gemulon.postgresql.org>
  References: <E1lMvft-0006he-Iw@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