| From: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: logical decoding: Correctly free speculative insertion |
| Date: | 2026-06-16 16:35:02 |
| Message-ID: | E1wZWkg-000asE-0I@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(dot)g(at)zohocorp(dot)com>
Reviewed-by: Hayato Kuroda <kuroda(dot)hayato(at)fujitsu(dot)com>
Backpatch-through: 14
Discussion: https://postgr.es/m/19c7623e882.4080fd5426212.311756747309556767@zohocorp.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/f50c329f538fdd979a849a06f425c8f9c94787a5
Modified Files
--------------
src/backend/replication/logical/reorderbuffer.c | 20 +++++------
src/test/subscription/t/100_bugs.pl | 45 +++++++++++++++++++++++++
2 files changed, 54 insertions(+), 11 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2026-06-16 17:28:50 | pgsql: doc PG 19 relnotes: update to current |
| Previous Message | Álvaro Herrera | 2026-06-16 12:30:02 | Re: pgsql: Add CONCURRENTLY option to REPACK |