From: Álvaro Herrera <alvherre@kurilemu.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Lock the TOAST table early in REPACK (CONCURRENTLY)
Date: Mon, 28 Sep 2026 15:13:43 +0000
Message-ID: <E1xBD31-00000001cLE-3okb@gemulon.postgresql.org> (raw)
Lock the TOAST table early in REPACK (CONCURRENTLY)
The decoding worker records the relfilenumber of the TOAST table when it
starts, and skips changes stored under any other one, but the TOAST
table was not locked until the data copy began. If VACUUM FULL rewrote
it while the worker was starting, concurrent updates of TOASTed columns
were silently lost.
Fix by locking the TOAST table in cluster_rel() in the concurrent case,
before the worker starts.
Author: Shihao Zhong <zhong950419@gmail.com>
Reported-by: Thom Brown <thom@linux.com>
Backpatch-through: 19
Discussion: https://postgr.es/m/CAA-aLv5MF6BLL+BWvix2Yw+CBardtH43AofPReQunhDZPNBtuA@mail.gmail.com
Branch
------
REL_19_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/76a268273c87b8efda86a3a729f5b89c60f48882
Modified Files
--------------
src/backend/commands/repack.c | 34 ++++-
src/backend/commands/repack_worker.c | 5 +-
.../injection_points/expected/repack_toast.out | 152 ++++++++++++++++++++-
.../injection_points/specs/repack_toast.spec | 45 ++++++
4 files changed, 229 insertions(+), 7 deletions(-)
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@kurilemu.de
Subject: Re: pgsql: Lock the TOAST table early in REPACK (CONCURRENTLY)
In-Reply-To: <E1xBD31-00000001cLE-3okb@gemulon.postgresql.org>
References: <E1xBD31-00000001cLE-3okb@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