agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Álvaro Herrera <alvherre@kurilemu.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: logical decoding: Correctly free speculative insertion
Date: Tue, 16 Jun 2026 16:35:02 +0000
Message-ID: <E1wZWkg-000asL-0T@gemulon.postgresql.org> (raw)
logical decoding: Correctly free speculative insertion
The error path in ReorderBufferProcessTXN was not freeing
(reorderbuffer.c's representation of) a speculative insertion record
correctly. In assert-enabled builds, this leads to an assertion
failure. In production builds, I see no effect; there may be a small
transient leak, but in an improbable code path such as this, such a leak
is not of any significance. For users running with assertions enabled,
the crash is annoying.
Fix by having ReorderBufferProcessTXN() free the speculative insert
ahead of freeing the rest of the transaction, and no longer try to
handle that insert as a separate argument to ReorderBufferResetTXN().
This code came in with commit 7259736a6e5b (14-era). Backpatch all the
way back.
In branches 14-16, also backpatch the assertion that originally fails in
the problem scenario, which was added by dbed2e36625d (originally
backpatched to 17), that at the end of ReorderBufferReturnTXN() the
in-memory size of the transaction is zero.
Author: Vishal Prasanna <vishal.g@zohocorp.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Backpatch-through: 14
Discussion: https://postgr.es/m/19c7623e882.4080fd5426212.311756747309556767@zohocorp.com
Branch
------
REL_16_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/813b0d8f455d38356a7c643e9c5170a185e2a21d
Modified Files
--------------
src/backend/replication/logical/reorderbuffer.c | 25 +++++++-------
src/test/subscription/t/100_bugs.pl | 45 +++++++++++++++++++++++++
2 files changed, 58 insertions(+), 12 deletions(-)
view thread (6+ messages) latest in thread
Message-ID: <E1wZWkg-000asL-0T@gemulon.postgresql.org>
Permalink: ../E1wZWkg-000asL-0T@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1wZWkg-000asL-0T@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 using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: alvherre@kurilemu.de, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: logical decoding: Correctly free speculative insertion
In-Reply-To: <E1wZWkg-000asL-0T@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox