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 1wD1ln-002X9T-0D for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Apr 2026 15:03:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wD1lm-000AOp-1D for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Apr 2026 15:03:10 +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 1wD1ig-0006wh-2h for pgsql-hackers@lists.postgresql.org; Wed, 15 Apr 2026 14:59:58 +0000 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wD1id-00000001EoJ-3YHw for pgsql-hackers@lists.postgresql.org; Wed, 15 Apr 2026 14:59:58 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 319961D0025C; Wed, 15 Apr 2026 10:59:53 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Wed, 15 Apr 2026 10:59:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1776265192; x=1776351592; bh=YKoAw5LwLH F2JpBvBF/Hgv5FmRhCO5GLlF1/4Kc8ADE=; b=JG/hiybswoJflPVihRAovv8KDt 5COzR/ejQfpmd2zPO8s1m2kOXPbiLpPjMvr+/LAeXY0ANxJPpO/gsJ7YX99qT6uR 9sfD7tSGcm6W6JKWX+1kh8RyYgRqIdunY/+AgSOR21j7vLMV8nBqRYkuEpeCAo4E MtsctMQUGTHmZpoNpqd3ZVSkoZ8+sOF700u66ibZqNZeijxkGHJTOmtYPK+pKdsY 93flLcaQbCwezmYAf1ncWGRvy9jzArFC6JQD3QxGVPRQgJ0cwoN38soq/7vm7dlv vfnWHVSFdPa1kGvXkQMbg+cLs3SZEw0supi4FeWwz1uw6iSuEoXTyB1h5+RA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1776265192; x=1776351592; bh=YKoAw5LwLHF2JpBvBF/Hgv5FmRhCO5GLlF1 /4Kc8ADE=; b=j7gAf7lmNAX9z3zH86MH+b/iieFCegPTbCNqbyiQFkodRzZb3GE 1TeqTRms9btL7KNwalXE//cd3Tex2PHlA8KGUAAuWrRtRZuk5Z+m8rdO0IFMh8s0 MlRVGJCiBp8+usr/4AXKW00UC3JTB5+JctKk15t/JhtIH4UP7jEuQgp3sm54GDBt NCmARtSNlu2imKOpDitf5PGf21Ja/qxRh8Lv0TNbqdRl8rITeRt7nh0SiCvbF2EA vmOZZ26y2yNeEAOb3oNlvFPLRULUI2y8ggA471rghclUdC751qQzdQvuVIG4qqOt 8tFWffXUq6dn1smHbhxnFZ6/fHTZGidFK+g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdeggeeflecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfhfgggtuggjsehttdfstddttddvnecuhfhrohhmpeetnhgurhgvshcu hfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrghtth gvrhhnpeeffffgledvffegtdevlefgtdeggffhvdekgfegteeiveejkeetudelveejhfeu geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnh gurhgvshesrghnrghrrgiivghlrdguvgdpnhgspghrtghpthhtohepkedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtoheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdroh hrghdprhgtphhtthhopegrhhestgihsggvrhhtvggtrdgrthdprhgtphhtthhopegrmhhi thdrkhgrphhilhgrudeisehgmhgrihhlrdgtohhmpdhrtghpthhtohepsghovghkvgifuh hrmhdophhoshhtghhrvghssehgmhgrihhlrdgtohhmpdhrtghpthhtohepmhhihhgrihhl nhhikhgrlhgrhigvuhesghhmrghilhdrtghomhdprhgtphhtthhopehsrhhinhgrthhhvd dufeefsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshes lhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhgpdhrtghpthhtoheprhhosgesgiiiih hllhgrrdhnvght X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Apr 2026 10:59:52 -0400 (EDT) Date: Wed, 15 Apr 2026 10:59:51 -0400 From: Andres Freund To: Antonin Houska Cc: Mihail Nikalayeu , Amit Kapila , Alvaro Herrera , Srinath Reddy Sadipiralla , Matthias van de Meent , Pg Hackers , Robert Treat Subject: Re: Adding REPACK [concurrently] Message-ID: References: <9539.1775724194@localhost> <112208.1776173876@localhost> <25514.1776264611@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <25514.1776264611@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2026-04-15 16:50:11 +0200, Antonin Houska wrote: > I thought of a "hypothetical graph", which would include the to-be-granted > lock, but the major issue is that it will not work correctly without the > locking the LMGR's LW locks we do in CheckDeadLock(): > > for (i = 0; i < NUM_LOCK_PARTITIONS; i++) > LWLockAcquire(LockHashPartitionLockByIndex(i), LW_EXCLUSIVE); > > And obviously, doing this each time we want to insert a lock into the queue > would be bad for performance. Hence my suggestion to do this as part of the deadlock check. Then we don't do this unnecessary work outside of the case where we actually need it. That does need to deal with the case of the deadlock check running first in the backend doing repack, but that's not that hard - I think it'd be good enough to set its deadlock timeout temporarily to a higher value. The backend *should* still run the deadlock detector, because it could probably still get into a deadlock (e.g. due to a pg_class access or something). Greetings, Andres Freund