agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Antonin Houska <ah@cybertec.at>
To: shihao zhong <zhong950419@gmail.com>
Cc: Robert Treat <rob@xzilla.net>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Manu <manuelreyesbravo@gmail.com>
Cc: Thom Brown <thom@linux.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 08:24:15 +0200
Message-ID: <4324.1790317455@localhost> (raw)
In-Reply-To: <CAGRkXqR+jco=86v10goPL5jQbKJJcK_dwWB_4dFh4CEDnN7jpg@mail.gmail.com>
References: <CAA-aLv5MF6BLL+BWvix2Yw+CBardtH43AofPReQunhDZPNBtuA@mail.gmail.com>
	<179012413951.1850281.5077495683381671561@gmail.com>
	<CAGRkXqRYLtBRaMzdH+e7PMO-BRaWPPo37gvOx3C=jQ1uP4Cx7w@mail.gmail.com>
	<47479.1790180571@localhost>
	<CAD21AoCYvsp5HFOXLx9BpSz6Lcyw7H9-RXtq-b=AA8joP8=-XA@mail.gmail.com>
	<CABV9wwMQ7-hQnOFc4yYo6oJv8eLE9OV0khFrpespwAkOKugsqw@mail.gmail.com>
	<10459.1790239287@localhost>
	<CAGRkXqR+jco=86v10goPL5jQbKJJcK_dwWB_4dFh4CEDnN7jpg@mail.gmail.com>

shihao zhong <zhong950419@gmail.com> wrote:

> > (What I said does not mean that I'm in favor of restarting the decoding worker
> > either. I still prefer locking the TOAST relation early, as I noted elsewhere
> > in the thread.)
> 
> OK. v3 locks the TOAST relation before the worker starts, as Sawada-san
> first suggested. A rewrite of the TOAST relation now waits for REPACK,
> which I think is also what Robert asked for.

Thanks for the patch. I'm just not sure this is the best place to lock the
TOAST table: note that copy_table_data() locks it again.

I'd prefer locking it close to the place we lock the main table (perhaps in
cluster_rel(), after all the checks have been done?) and replace the locking
statements (both in the copy_table_data() and in your patch) with
Assert(CheckRelationLockedByMe(...)).

-- 
Antonin Houska
Web: https://www.cybertec-postgresql.com






view thread (28+ messages)  latest in thread

Message-ID: <4324.1790317455@localhost>
Permalink:  ../4324.1790317455@localhost/
Also on:    postgresql.org/message-id/4324.1790317455@localhost

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: ah@cybertec.at, zhong950419@gmail.com, rob@xzilla.net, sawada.mshk@gmail.com, manuelreyesbravo@gmail.com, thom@linux.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: REPACK (CONCURRENTLY) can silently lose updates when the toast table is rewritten
  In-Reply-To: <4324.1790317455@localhost>

* 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