agora inbox for pgsql-hackers@postgresql.org
help / color / mirror / Atom feedFrom: Álvaro Herrera <alvherre@kurilemu.de>
To: Thom Brown <thom@linux.com>
Cc: Antonin Houska <ah@cybertec.at>
Cc: shihao zhong <zhong950419@gmail.com>
Cc: Robert Treat <rob@xzilla.net>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Manu <manuelreyesbravo@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: REPACK (CONCURRENTLY) can silently lose updates when the toast table is rewritten
Date: Fri, 25 Sep 2026 16:56:58 +0200
Message-ID: <araJcIXmBySfiXzc@alvherre.pgsql> (raw)
In-Reply-To: <CAA-aLv6SMuRVomk6yqh8i9hHF_iHYMZBYhR8dH6M-=x219KOSw@mail.gmail.com>
On 2026-Sep-25, Thom Brown wrote:
> Moving it into cluster_rel() makes sense, but does it need to be the
> full ShareUpdateExclusiveLock there?
Yeah, it's better to acquire the lock you want upfront, because
otherwise you introduce more risk of deadlock caused by lock upgrades
(admittedly the user would have to be doing something really stupid in
order for this to be a real problem, but still.) It's only AEL that we
don't want to hold for long.
Maybe the patch could be somewhat like this, then? I didn't review the
test carefully other than running without the code fix to verify that it
fails, and then passes with the fix; and I didn't read the commit
messages either, which I think are LLM-written and not really correct.
(Also, I would push both things as a single commit.)
I think changing the lock as obtained by copy_table_data is not very
nice, because that one is unconditional, and here we only want it in
concurrent mode. BTW I noticed that the comment for copy_table_data
mentions decoding_ctx as an argument, which doesn't exist.
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"Nunca se desea ardientemente lo que solo se desea por razón" (F. Alexandre)
Attachments:
[text/x-diff] v4-0001-Test-TOAST-rewrite-during-REPACK-CONCURRENTLY-sta.patch (0B, ../araJcIXmBySfiXzc@alvherre.pgsql/2-v4-0001-Test-TOAST-rewrite-during-REPACK-CONCURRENTLY-sta.patch)
download
view thread (28+ messages) latest in thread
Message-ID: <araJcIXmBySfiXzc@alvherre.pgsql>
Permalink: ../araJcIXmBySfiXzc@alvherre.pgsql/
Also on: postgresql.org/message-id/araJcIXmBySfiXzc@alvherre.pgsql
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-hackers@postgresql.org
Cc: alvherre@kurilemu.de, thom@linux.com, ah@cybertec.at, zhong950419@gmail.com, rob@xzilla.net, sawada.mshk@gmail.com, manuelreyesbravo@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: REPACK (CONCURRENTLY) can silently lose updates when the toast table is rewritten
In-Reply-To: <araJcIXmBySfiXzc@alvherre.pgsql>
* 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