pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Munro <tmunro@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Free disk space for dropped relations on commit.
Date: Tue, 01 Dec 2020 02:22:55 +0000
Message-ID: <E1kjvJf-00073b-7L@gemulon.postgresql.org> (raw)

Free disk space for dropped relations on commit.

When committing a transaction that dropped a relation, we previously
truncated only the first segment file to free up disk space (the one
that won't be unlinked until the next checkpoint).

Truncate higher numbered segments too, even though we unlink them on
commit.  This frees the disk space immediately, even if other backends
have open file descriptors and might take a long time to get around to
handling shared invalidation events and closing them.  Also extend the
same behavior to the first segment, in recovery.

Back-patch to all supported releases.

Bug: #16663
Reported-by: Denis Patron <denis.patron@previnet.it>
Reviewed-by: Pavel Borisov <pashkin.elfe@gmail.com>
Reviewed-by: Neil Chen <carpenter.nail.cz@gmail.com>
Reviewed-by: David Zhang <david.zhang@highgo.ca>
Discussion: https://postgr.es/m/16663-fe97ccf9932fc800%40postgresql.org

Branch
------
REL_11_STABLE

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

Modified Files
--------------
src/backend/storage/smgr/md.c | 89 +++++++++++++++++++++++++++++++------------
1 file changed, 65 insertions(+), 24 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1kjvJf-00073b-7L@gemulon.postgresql.org>
Permalink:  ../E1kjvJf-00073b-7L@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kjvJf-00073b-7L@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: tmunro@postgresql.org
  Subject: Re: pgsql: Free disk space for dropped relations on commit.
  In-Reply-To: <E1kjvJf-00073b-7L@gemulon.postgresql.org>
  References: <E1kjvJf-00073b-7L@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