Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x9zM5-00000002OA6-3el0 for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Sep 2026 06:24:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1x9zM4-0000000GjTW-3lyI for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Sep 2026 06:24:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x9zM4-0000000GjTO-2Qyh for pgsql-hackers@lists.postgresql.org; Fri, 25 Sep 2026 06:24:20 +0000 Received: from mail-wm2-x11.google.com ([2a00:1450:4864:31::11]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1x9zM2-00000001BjD-0uR3 for pgsql-hackers@lists.postgresql.org; Fri, 25 Sep 2026 06:24:20 +0000 Received: by mail-wm2-x11.google.com with SMTP id 5b1f17b1804b1-49e71cdb22bso3533125e9.2 for ; Thu, 24 Sep 2026 23:24:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1790317457; x=1790922257; darn=lists.postgresql.org; h=message-id:date:content-transfer-encoding:content-id:content-type :mime-version:comments:references:in-reply-to:subject:cc:to:from :from:to:cc:subject:date:message-id:reply-to:content-type; bh=uKZP1a15YKSiiEtNsUlwRTLSTTOVO5nFS8Scz3VmEIY=; b=TiB4/gFWDXwJtg0g/9ByIiglUC+nO722T7Cpina/R9sSh2SniSCOTYaw/91PLWj/cM c95AWmhHc6BrtzxISeUgk+N0arXzeVYa/+6i6Fi+3wOxX2JxqIdM1rBHJQQWhwHCBwmM by/UfFcbLtkUqhlkW/6WnkUbDmD9kUvTR6lwlQFB8b8acCOQrq72yNONBbuthB0SEtxT XZlrGxkUIS+WmusFsfvrS2SR7grjlCjZFjyBOg4AwXt1cvKlVopcV1+dUMF8lMf2av6v 7IMMhmMHCBYgMYwWPE9wdNb/TgR5i8yvThWaWbji/g12hcW4bFLYh7j5HTo3dCZSy/m2 W2Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790317457; x=1790922257; h=message-id:date:content-transfer-encoding:content-id:content-type :mime-version:comments:references:in-reply-to:subject:cc:to:from :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=uKZP1a15YKSiiEtNsUlwRTLSTTOVO5nFS8Scz3VmEIY=; b=u7t5P7B79QMq+VcDjzzS7v/yBwr7DegBnQh6XV3BIo92o5PxNYZ+MLqRjuZi/xKisO rixPnDt1qhg8BOThXzWk7PNDZhJdeXUBm66dt81QH1g9TsRjxfH7kvdiSDDKCcJa1Vnn S+Y1kyfXYUDyyaEdbJSnPvTpzeBr+MJp8YCP9vtfzl8Y3nOmrpM46N3ArhwrNHapAzku x322DpdgvnJNT/i7Uw+nlwkuT4YIvrynU7ydDU5qy/txSpL2yUL6YB85zxrW2fcMfSwx RVDK+NLZSkIpd9AkXQELVGwPUcXny0XB7UowSuCZiAucQlNenaASuQRtTC5XN47auM2y qcrw== X-Forwarded-Encrypted: i=1; AKwUvBzsPSyxbKYlf079RocI8EuwGwe5bIBs8simnKd0V7RwN/F5cRiwrSR8MCxfwYUi/tYxSa3csfSJ7OcDo8Vr@lists.postgresql.org X-Gm-Message-State: AFuF++kYQOKICBbKJ0t5xbrCoAnjChXddTffWmiQMscUoqH9J2Qlst9h HofpWaH8powdEG873ZwVhu/9VuOY1Xdq9baGG+fTMeHJU8IRRf3LdzbCKukAL8IXZGg= X-Gm-Gg: AYBFou2w1CWMUO5ge1FJ4ZL1SCkCaGTObC9QfAobnI/0F6dKt5tbJTkeuDqADqH3D2n 6jZOAVmAD/MsGrIq91bSp4TpoU/myF07vpP4deennIHI16V5zoEqnpRMijnZ9gZpsw5bd/5/G/e GIFLF7gb7hrFebDhxrmqv/fdiV8gTkdXM37TKmA5VDEg1dW7DqYZsl4Roq0d7BMYEVc8kYMXXbc f1mRLKN1hTIOEX7qx9YJr8eGGa0+cSEgRIBcsgDNcg78rCUrpl3jSEgVnZC1SCWJUPYpDowN2JT reS+HwBOM3XxxwGKx2f/Rv6Ncl72a0PW192fZNUKmEtdv6sPuRVLWndoyVWk7vPJjTERU0TbdNJ Tk5AEB2Ug4XkhuLHcdPHsgFoRq3PBzKin3hm2fXv08OLzFu4trMAbhPdnb3B1wyq2z6zL3v5eXq HGTYSl1ASfO2ePUHq7ROTFsZm5czZAyG0Y8OuqGUVsYiYdH7WPDFLCdWUTsUZ80088rs0lLAXDg m9SAvY14Q== X-Received: by 2002:a05:600c:630c:b0:49c:ffde:45ff with SMTP id 5b1f17b1804b1-49fe66eb254mr76733025e9.17.1790317456933; Thu, 24 Sep 2026 23:24:16 -0700 (PDT) Received: from localhost (109-81-170-16.rct.o2.cz. [109.81.170.16]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49ff13b3c58sm14392915e9.0.2026.09.24.23.24.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Sep 2026 23:24:16 -0700 (PDT) From: Antonin Houska To: shihao zhong cc: Robert Treat , Masahiko Sawada , Manu , Thom Brown , pgsql-hackers@lists.postgresql.org Subject: Re: REPACK (CONCURRENTLY) can silently lose updates when the toast table is rewritten In-reply-to: References: <179012413951.1850281.5077495683381671561@gmail.com> <47479.1790180571@localhost> <10459.1790239287@localhost> Comments: In-reply-to shihao zhong message dated "Fri, 25 Sep 2026 00:32:11 -0400." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4323.1790317455.1@localhost> Content-Transfer-Encoding: quoted-printable Date: Fri, 25 Sep 2026 08:24:15 +0200 Message-ID: <4324.1790317455@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk shihao zhong wrote: > > (What I said does not mean that I'm in favor of restarting the decodin= g worker > > either. I still prefer locking the TOAST relation early, as I noted el= sewhere > > 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 i= n cluster_rel(), after all the checks have been done?) and replace the locki= ng statements (both in the copy_table_data() and in your patch) with Assert(CheckRelationLockedByMe(...)). -- = Antonin Houska Web: https://www.cybertec-postgresql.com