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@postgresql.org
Subject: pgsql: Fix failure to delete spill files of aborted transactions
Date: Fri, 05 Jan 2018 15:17:49 +0000
Message-ID: <E1eXTkj-00055Z-LV@gemulon.postgresql.org> (raw)

Fix failure to delete spill files of aborted transactions

Logical decoding's reorderbuffer.c may spill transaction files to disk
when transactions are large.  These are supposed to be removed when they
become "too old" by xid; but file removal requires the boundary LSNs of
the transaction to be known.  The final_lsn is only set when we see the
commit or abort record for the transaction, but nothing sets the value
for transactions that crash, so the removal code misbehaves -- in
assertion-enabled builds, it crashes by a failed assertion.

To fix, modify the final_lsn of transactions that don't have a value
set, to the LSN of the very latest change in the transaction.  This
causes the spilled files to be removed appropriately.

Author: Atsushi Torikoshi
Reviewed-by: Kyotaro HORIGUCHI, Craig Ringer, Masahiko Sawada
Discussion: https://postgr.es/m/54e4e488-186b-a056-6628-50628e4e4ebc@lab.ntt.co.jp

Branch
------
REL9_4_STABLE

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

Modified Files
--------------
src/backend/replication/logical/reorderbuffer.c | 19 +++++++++++++++++--
src/include/replication/reorderbuffer.h         |  2 ++
2 files changed, 19 insertions(+), 2 deletions(-)



view thread (5+ messages)

Message-ID: <E1eXTkj-00055Z-LV@gemulon.postgresql.org>
Permalink:  ../E1eXTkj-00055Z-LV@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1eXTkj-00055Z-LV@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: Fix failure to delete spill files of aborted transactions
  In-Reply-To: <E1eXTkj-00055Z-LV@gemulon.postgresql.org>
  References: <E1eXTkj-00055Z-LV@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