pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix decoding of speculative aborts.
Date: Tue, 15 Jun 2021 03:56:23 +0000
Message-ID: <E1lt0Bb-0005yn-UF@gemulon.postgresql.org> (raw)

Fix decoding of speculative aborts.

During decoding for speculative inserts, we were relying for cleaning
toast hash on confirmation records or next change records. But that
could lead to multiple problems (a) memory leak if there is neither a
confirmation record nor any other record after toast insertion for a
speculative insert in the transaction, (b) error and assertion failures
if the next operation is not an insert/update on the same table.

The fix is to start queuing spec abort change and clean up toast hash
and change record during its processing. Currently, we are queuing the
spec aborts for both toast and main table even though we perform cleanup
while processing the main table's spec abort record. Later, if we have a
way to distinguish between the spec abort record of toast and the main
table, we can avoid queuing the change for spec aborts of toast tables.

Reported-by: Ashutosh Bapat
Author: Dilip Kumar
Reviewed-by: Amit Kapila
Backpatch-through: 9.6, where it was introduced
Discussion: https://postgr.es/m/CAExHW5sPKF-Oovx_qZe4p5oM6Dvof7_P+XgsNAViug15Fm99jA@mail.gmail.com

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/43acadfcebec36f4db2074e125b2af15d3afda1a

Modified Files
--------------
src/backend/replication/logical/decode.c        | 14 ++++----
src/backend/replication/logical/reorderbuffer.c | 48 ++++++++++++++++++-------
src/include/replication/reorderbuffer.h         | 11 +++---
3 files changed, 48 insertions(+), 25 deletions(-)



view thread (6+ messages)

Message-ID: <E1lt0Bb-0005yn-UF@gemulon.postgresql.org>
Permalink:  ../E1lt0Bb-0005yn-UF@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lt0Bb-0005yn-UF@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: akapila@postgresql.org
  Subject: Re: pgsql: Fix decoding of speculative aborts.
  In-Reply-To: <E1lt0Bb-0005yn-UF@gemulon.postgresql.org>
  References: <E1lt0Bb-0005yn-UF@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