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 1wAqF8-000RJM-09 for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Apr 2026 14:20:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wAqF6-005zGY-1D for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Apr 2026 14:20:25 +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 1wAqF6-005zGP-0J for pgsql-hackers@lists.postgresql.org; Thu, 09 Apr 2026 14:20:24 +0000 Received: from fhigh-b2-smtp.messagingengine.com ([202.12.124.153]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wAqF4-00000000C2m-17tq for pgsql-hackers@lists.postgresql.org; Thu, 09 Apr 2026 14:20:24 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id 22A997A0203; Thu, 9 Apr 2026 10:20:20 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Thu, 09 Apr 2026 10:20:20 -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=1775744419; x=1775830819; bh=l4qdMrCQHH YR0BdhfiPzPi6aa66MSGahziR3aTadDmE=; b=oY7Jx3YKMIal5D40hK5pZk3dm0 y3RvJkncFpP6ACCSWHOmuFCnBiZ1s3FjDI4mv808rVS+qazxM9kX8GwYlh1DYmg2 HJ2Djqr3Liz0UXU7VJ4QGgqbh3ctvV0Vtm1YYrbPBOx+X/tHIUwvatem+Q8B3jGz 8CK7A9nzdAkATcgqydnpkQ5XHjWl+4i1l5lzqDSm1j6BXoENTNKoMGIVBSE3kf+2 sjJf18wmmfxv/ar5uGE3SqmwGXV1aJ8/q+ofsXr9TNsMNl/UVCp6Bbt9i/X0cJb1 9Q4LuEmJCJZixW18HXJZbGZP8xIPpNlaYF2dRbtXDDEzr+w32OZnKISDo0+Q== 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= 1775744419; x=1775830819; bh=l4qdMrCQHHYR0BdhfiPzPi6aa66MSGahziR 3aTadDmE=; b=MQwGmxdRxJCQjWU162f+JV0tmFVzZu+bTo4kp7BE/qYe+8iJarN iGmpZbta7ekDUs9K4b5aZ/eNA8kS1/eWGih7E9uD94bUl75nzJYPXK4Eu+A8ddlZ VlH/nkTE4zIt5Z8ZFeTg5+UaEwsUbLP8L4y2g+AfVEff2YLQlGfuW+xw4REbDDgc jAToKT8uLc+IAyH85afhFXvUBZf/6j/iakGPuGPY5lpK/xMOBDt4W7eMBGfBJUIX w3TMbI/0YZO95F4Xv5brxgO2dKjLdLNdHAY+iKlcp6PSHUwoWFzLUSoVmrMADHTP 777pVW/S9DdM/kh5Ynj9iHnfMRhAQj2W3IQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddvieejtdcutefuodetggdotefrod 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; Thu, 9 Apr 2026 10:20:18 -0400 (EDT) Date: Thu, 9 Apr 2026 10:20:18 -0400 From: Andres Freund To: Antonin Houska Cc: Amit Kapila , Mihail Nikalayeu , Alvaro Herrera , Srinath Reddy Sadipiralla , Matthias van de Meent , Pg Hackers , Robert Treat Subject: Re: Adding REPACK [concurrently] Message-ID: References: <202604062213.cgo352cdsgsm@alvherre.pgsql> <4n4q3preb3lgyhpzstebhux7b2aojhsw7gik4ivaznyggiezrs@lrznutssxlh2> <9539.1775724194@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9539.1775724194@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2026-04-09 10:43:14 +0200, Antonin Houska wrote: > What Andres proposed (AFAIU) should help to avoid this problem because > REPACK's request for AEL would get in front of the VACUUM's request for SUEL > in the queue. Note that that already happens today. This works today (without the error triggering patch): S1: REPACK starts S2: LOCK TABLE / VACUUM / ... starts waiting S1: REPACK tries to get AEL S1: REPACK's lock requests get reordered in the wait queue to be before S2 and just gets the lock S1: REPACK finishes S2: lock acquisition completes. That's because we do already have this "jumping the wait queue" logic, which I had forgotten about. What does *not* work is this: S1: REPACK starts S2: BEGIN; SELECT 1 FROM table LIMIT 1; S2: LOCK TABLE / VACUUM / ... starts waiting S1: REPACK tries to get AEL S1: lock is not granted, can't be reordered to be before S2, because S2 holds conflicting lock, deadlock detector triggers S2: lock acquisition completes But with my proposal to properly teach the deadlock detector about assuming there's a wait edge for the eventual lock upgrade by S1, the first example would still work, because the lock upgrade would not be considered a hard cycle, and the second example would have S2 error out. > Anti-wraparound (failsafe) VACUUM is a bit different case [1] (i.e. it should > possibly have higher priority than REPACK), but I think this prioritization > should be implemented in other way than just letting it get in the way of > REPACK (at the time REPACK is nearly finished). Yea, it makes no sense to interrupt the long running repack, given that the new relation will have much less stuff for vacuum to do. Greetings, Andres Freund