pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Clean up temporary WAL segments after an instance crash
Date: Thu, 12 Jul 2018 21:44:09 +0000
Message-ID: <E1fdjNh-00059Q-7l@gemulon.postgresql.org> (raw)

Clean up temporary WAL segments after an instance crash

Temporary WAL segments are created in pg_wal and named as xlogtemp.pid
before being renamed to the real deal when creating a new segment.  If
an instance crashes after the temporary segment is created and before
the rename is done, then the server would finish with unremovable data.

After an instance crash, scan pg_wal and remove any such segments.  With
repetitive unlucky crashes this would contribute to disk bloat and
presents risks of ENOSPC especially with max_wal_size close to the
maximum allowed.

Author: Michael Paquier
Reviewed-by: Yugo Nagata, Heikki Linnakangas
Discussion: https://postgr.es/m/20180514054955.GF1528@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5fc1008e8a8b9e96ac75b4db5dd9ad2b99a9c8b2

Modified Files
--------------
src/backend/access/transam/xlog.c | 52 +++++++++++++++++++++++++++++++++------
1 file changed, 45 insertions(+), 7 deletions(-)



Message-ID: <E1fdjNh-00059Q-7l@gemulon.postgresql.org>
Permalink:  ../E1fdjNh-00059Q-7l@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1fdjNh-00059Q-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: michael@paquier.xyz
  Subject: Re: pgsql: Clean up temporary WAL segments after an instance crash
  In-Reply-To: <E1fdjNh-00059Q-7l@gemulon.postgresql.org>
  References: <E1fdjNh-00059Q-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