pgsql: Fix failure to delete spill files of aborted transactions - Mailing list pgsql-committers

From Alvaro Herrera
Subject pgsql: Fix failure to delete spill files of aborted transactions
Date
Msg-id E1eXTkj-00055R-L3@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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
------
master

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

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


pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: Another attempt at fixing build with various OpenSSL versions
Next
From: Bruce Momjian
Date:
Subject: pgsql: pg_upgrade: simplify code layout in a few places