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.96) (envelope-from ) id 1wAOOQ-002Kwf-1J for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2026 08:36:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wAOOO-0065fp-18 for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2026 08:36:08 +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.96) (envelope-from ) id 1wAOOO-0065fh-0C for pgsql-hackers@lists.postgresql.org; Wed, 08 Apr 2026 08:36:08 +0000 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wAOOJ-00000001GZo-01ta for pgsql-hackers@lists.postgresql.org; Wed, 08 Apr 2026 08:36:07 +0000 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-38e09b14102so21707541fa.0 for ; Wed, 08 Apr 2026 01:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775637361; cv=none; d=google.com; s=arc-20240605; b=Pq5PW5RqAiZBNN9t0feCAoqQ6FbMu25hUiAstqLRKsUlgsvKpcwY2a62NuC0d6MF+T 6/TV/8Glu+yR9IbUuf7nUFuP3yEJiRBq07/Y85TUmLoqptyNJl2ZS3kD78X1WONmjn3F pODTJLqgt3NE5213D5usKTChGUTN1iw1Q2YIthO2sb7kuEbEaweq3ZjaC0/ZcN9X85Sy af966V4mIMkRcL6HdxUtlTTQw7A/3fj3F6GqK2v+sYVpeNESZMqWmhK6+YL3Jixim+r/ 0Ed7HnodLiDoJdrETC5zojv6PKv2FR87aenfbAKeW10Csk6a9QhUkoSVZF6Fl3Jco7MM vLoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Q4XIIxNfj8IVjMzBonhph1wqFulsLxSq7Oniled9vMQ=; fh=xlT7E4fi+M7urQKT6QGdz5b7YGUbvgqbLvqyjuwHXh8=; b=VDNEcbsLm9a80a+Id3CXTInMieSkTMq5g0j08SFjowa9PV8Zfcca20Df4wDx1/oxWm QmVybI2bPUD3FUiYClJX8CFuxtfTy3DuHl0JSYDeqnIZsKFNn9IvBh27dNRB9fglLAzC 8ym/cVB0VMWDDnC1Aq46Bts1ZXH3avM9bBsK+k4wYtK2MwM1af5b+fAI8iec1vGqLqwo nhok9ov7r5Fbv0u6FvW/Dszm5y5HR8evYkd1q/BSHPZNfuIwWUg6MRjJUzPdKJDhovRr Airf+fU9eiin0THbyzlUZm4Eo7sOcxSy7x7eHCU0jpmMVaPT6K1GqOzvKJNYCjpvdw2M h/Jg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775637361; x=1776242161; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Q4XIIxNfj8IVjMzBonhph1wqFulsLxSq7Oniled9vMQ=; b=W+dou9Rlkco3UK9Cxe9HFIR8xAmKZyfzdDPb6iU1IHkzc4rTjC/Eb8CDd9E9HkzG8b daIL1ewbgHvuoXJiznJnsXm1GCJ6r9QVqFuj152Ch7H4BmkMLdXd5BD0oVm233B0u/3N uLGIKEf/IgbA/dEPmtsUVEXnevmBKcjVUIqbO8Ma7SBXNxxYhpSJXUL/OaeZMrMZgyu5 DkHHYHDqNlozKpzO9jNeW8/uIj0O29em6WIBMz2BPvXv9o0yCiO17xW8qIb2jy6HJE71 cb0A5mL7YMfR4HK+V84cb2vWSo4OQbW1HrH6xz1dcXQ5z7LaCSsBnQMoixqFSjt74hpf E6/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775637361; x=1776242161; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Q4XIIxNfj8IVjMzBonhph1wqFulsLxSq7Oniled9vMQ=; b=q+2z+k+S86UJ8akLpEMK/GnabQ67PQYvb40vUjQoOpTEFnsnV+loATSm5jNOe9rXGm evODaej8S3E3CdQqK5V18KEcKPEXRjouU4hHN7rKteYHmyE+8ydWoyar0F3Aw5n1/hz/ uSYXzO6aZnB1i4qn3azopKSECNO/OKksToVAO9JrgusWU3kR5W4HZz1mbYitbu6W8EHh j7O5ous0E7CCL/2ADgl0GWvxaKgDh1gCWR82gsunaoV0gqLnUUghjhHct/4JlQndHj4+ N5zAtjBj0jf/JQAniwI8m+g2/yUmYZbR59HRxBAhl0o8HFhireniUpBXveVPaJYPGrYA HRNQ== X-Forwarded-Encrypted: i=1; AJvYcCVBiRntw5PI6QwIldxzbNwDu/ft003z9eieuOwscLjO0wi/5wCSA90G+5si5+XD7SLeGz/bgYOxpPKO29tL@lists.postgresql.org X-Gm-Message-State: AOJu0YyZTytXzaYlYN75H0TdSBW4aQE10avluaQwAl3Used4byQZuvNM /gPe/FSLimRgDLlP4k8oWm5LEFc507RXZal/XtnA5+dvwEpLxK6cQA5EgOF2ntWmja0kfi/9Q72 qHNwFMXGfls0QTIzaN545NtOKSewzMHs= X-Gm-Gg: AeBDietT6vD5abq8sJa1TRPr5VFrGX4FSCzIhUPuKo+C8gRsEsfpjSOUPaYawNymLGQ cdyAAHpoUjzn6PsFUwaok2oJ7bN9+WNMwejjqgzKpD+bUe39Z22Cn2jsGU+4MkTphHdxzulnB01 i4lOR63c7D+hH+s5yYBPG3D7vDnny+ne5jQsKl1c7qX8yJdFQ1wF7FHQqdlvNdQo7t2MY5gFE5D HJkKxjwOaV5aJMknLy9avostsGmdSw/ekbWZGsRuT1Wm9fKQiHd2mIgJP9YfUhb2HzS+bruZh6R w+DDOyfKnz06YWiOB/L2X4oiz/8ivgk1kcd9jy8= X-Received: by 2002:a05:651c:1b13:b0:38b:f0f0:e38f with SMTP id 38308e7fff4ca-38d91d78c88mr57701151fa.2.1775637361248; Wed, 08 Apr 2026 01:36:01 -0700 (PDT) MIME-Version: 1.0 References: <202604062213.cgo352cdsgsm@alvherre.pgsql> <4n4q3preb3lgyhpzstebhux7b2aojhsw7gik4ivaznyggiezrs@lrznutssxlh2> In-Reply-To: <4n4q3preb3lgyhpzstebhux7b2aojhsw7gik4ivaznyggiezrs@lrznutssxlh2> From: Amit Kapila Date: Wed, 8 Apr 2026 14:05:49 +0530 X-Gm-Features: AQROBzAv9nOsrmaDBPVzPYnGOfi2B0zJbxM3x1jH8-Mw7c_e-FGVofqReCgs9Ao Message-ID: Subject: Re: Adding REPACK [concurrently] To: Andres Freund Cc: Alvaro Herrera , Mihail Nikalayeu , Antonin Houska , Srinath Reddy Sadipiralla , Matthias van de Meent , Pg Hackers , Robert Treat Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Apr 8, 2026 at 1:54=E2=80=AFAM Andres Freund w= rote: > > Hi, > > On 2026-04-07 00:22:32 +0200, Alvaro Herrera wrote: > > From 4303eea0a72408183f9f5afcf8d2801df20f8ffe Mon Sep 17 00:00:00 2001 > > From: Antonin Houska > > Date: Wed, 1 Apr 2026 17:35:47 +0200 > > Subject: [PATCH v56 3/3] Error out any process that would block at REPA= CK > > > > Any process waiting on REPACK to release its lock would actually cause > > it to deadlock when it tries to upgrade its lock to AEL, losing all wor= k > > done to that point. We avoid this by teaching the deadlock detector to > > raise an error when this condition is detected. > > I'm rather doubtful that that is ok. > Another possible idea is that after copying table_data to the new table, we mark the old table as in_use_by_repack and release the ShareUpdateExclusiveLock on the old table. Then the function CheckTableNotInUse() should be updated to give an ERROR if the table is marked as in_use_by_repack. Now, acquiring AEL by repack (concurrently) should be safe because all concurrent DDLs should be errored out due to flag in_use_by_repack. Can this address the problem we are worried about the lock upgrade? --=20 With Regards, Amit Kapila.