agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Álvaro Herrera <alvherre@kurilemu.de>
To: Manu <manuelreyesbravo@gmail.com>
Cc: shihao zhong <zhong950419@gmail.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Thom Brown <thom@linux.com>
Cc: Antonin Houska <ah@cybertec.at>
Cc: Robert Treat <rob@xzilla.net>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: REPACK (CONCURRENTLY) can silently lose updates when the toast table is rewritten
Date: Mon, 28 Sep 2026 17:35:46 +0200
Message-ID: <arqEOe67h7Xeu4FB@alvherre.pgsql> (raw)
In-Reply-To: <179036565943.2118102.16573869613641283994@gmail.com>

On 2026-Sep-25, Manu wrote:

> Hi,
> 
> shihao zhong <zhong950419@gmail.com> wrote:
> > Done in v5. 0001 is Álvaro's version as one commit, with that comment
> > added and a shorter commit message. 0002 fixes the decoding_ctx comment
> > in copy_table_data().
> 
> I ran v5 through the same checks as v3, on master and on
> REL_19_STABLE, where it applies cleanly.

Thanks!  I have pushed this.  I apologize for forgetting to list
reviewers in the commit message :-(  But I also failed to remember in
time that doing CheckRelationOidLockedByMe() doesn't actually check
anything, and that it needs to be used in conjunction with Assert().  I
have pushed a fix for that and wrote the "Reviewed-by" trailers there.

Anyway, regarding the patch, I changed some comments a little bit more.
The only change of actual significance is that I revisited my earlier
idea of not touching copy_table_data: I did change the lock acquisition
into an assert, when in concurrent mode.  This is what Antonin had
suggested back in [1], and I thought would be "not very nice", but I
think I was mistaken.

[1] https://postgr.es/m/4324.1790317455@localhost

Regarding the deadlock when a conflicting lock on the toast table is
acquired during the initial steps, I'm not too worried about it; I think
it's on the spirit of "play stupid games, win you-know-what-kind-of-
prizes", and it hopefully won't be too bad in practice.


-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
"No necesitamos banderas
 No reconocemos fronteras"                  (Jorge González)






view thread (29+ messages)

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