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 1wBvRT-001VJW-10 for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Apr 2026 14:05:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wBvRR-002Vwp-28 for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Apr 2026 14:05:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wBvRR-002Vwh-1H for pgsql-hackers@lists.postgresql.org; Sun, 12 Apr 2026 14:05:38 +0000 Received: from fout-b3-smtp.messagingengine.com ([202.12.124.146]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wBvRQ-00000000e9Q-16mX for pgsql-hackers@lists.postgresql.org; Sun, 12 Apr 2026 14:05:37 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 1240E1D00094; Sun, 12 Apr 2026 10:05:35 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Sun, 12 Apr 2026 10:05:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-transfer-encoding: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=1776002734; x=1776089134; bh=12871ZE5qb9YCus513zXnUY8yI6Kt4JVIsBhwY93kQU=; b= q+GZuzefgbaZKY7HjfprFsqTMsXTsxKtet5wo59jnj4Pd/A6rRDVuc+eaKm1FTJh a7ZOvRvBea/GBCBn/Y0Mm5G9lpcicv4IdkBwZr4dQDskP5F6DXiKU2pSxMvZjYnt kEZrZeTLqon4/uT6mIoKqjmhvki9UCT53ycO31OiD6pG9SFNxoX4ToHPH9zdKmIo JReNUbLBDfkS7b9vLigzrThysdZnsFb2rT+/1uWxB8y6drJAFVoJjM04VGFuIv3w BddL2JN6AqbdRyamyX3r6hb1icsvy2WAFf/QzoyEXfYZ+J2DiTMOfNHwysLxJUqx PDLqxt2morhrcbkiU+53jw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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=1776002734; x= 1776089134; bh=12871ZE5qb9YCus513zXnUY8yI6Kt4JVIsBhwY93kQU=; b=m R3rRRgnpBXdOtTW/NNUNU0Mzx9iV5eiBThyYx/CD+z07CDk8dIdNqwt09CrJd2xx d4nuaqcUnaUyTRGL0t2Ni4eUe6lKYXQgPYPV5DGkF2CRkuK/o/1eW3vZ2K/vwzRR MkeSu0wnJlsG+IxNRqMQ+JLcsSJ5xnAfjybDiKQXNl0aKSLzP/PtFGoiKnBXgqmo 4no0TQPF4lg1ei90y4G8m742z2D/IH1pdpTuF+tdq7Eu+QRUNXDwc0bwHREq+Sh7 ULqxNk8cPxzsj12SpYYGpblnrOPqstkPEusrvr//3UrKpBSoPJCUBo+QVZtXxptZ 10XcRkVzPs6UPjag3TnlA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdefheeglecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfhfgggtugfgjgestheksfdttddtjeenucfhrhhomheptehnughrvghs ucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrfgrth htvghrnheptdelledvgfejvdffieeukeefueelfffhgeffhffgffekveeuheeihefhiefg hfdvnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomheprg hnughrvghssegrnhgrrhgriigvlhdruggvpdhnsggprhgtphhtthhopeekpdhmohguvgep shhmthhpohhuthdprhgtphhtthhopegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprd horhhgpdhrtghpthhtoheprghhsegthigsvghrthgvtgdrrghtpdhrtghpthhtoheprghm ihhtrdhkrghpihhlrgduieesghhmrghilhdrtghomhdprhgtphhtthhopegsohgvkhgvfi hurhhmodhpohhsthhgrhgvshesghhmrghilhdrtghomhdprhgtphhtthhopehmihhhrghi lhhnihhkrghlrgihvghusehgmhgrihhlrdgtohhmpdhrtghpthhtohepshhrihhnrghthh dvudeffeesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhs sehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopehrohgsseigii hilhhlrgdrnhgvth X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 12 Apr 2026 10:05:34 -0400 (EDT) Date: Sun, 12 Apr 2026 10:05:34 -0400 From: Andres Freund To: Mihail Nikalayeu Cc: Antonin Houska , Amit Kapila , 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2026-04-12 15:31:20 +0200, Mihail Nikalayeu wrote: > On Thu, Apr 9, 2026 at 4:20 PM Andres Freund wrote: > > 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. > > Attached patch contains some (maybe naive) POC for similar approach. > It adds a 'deadlock_protected' flag, which changes how the deadlock > detector cancels backends. > > Instead of cancelling the backend entered the deadlock detector - it > cancel some another (nearest hard edge) until it is possible to get the > lock (either by > reordering or directly). I don't think that's as good. The problem is that that way you're only detecting the deadlocks once they have materialized (i.e. once repack actually does the lock upgrade), rather than cancelling when we know that the problem starts. Having sessions pointlessly blocked for many hours is bad. > Also, I added test cases with the scenarios you mentioned into the repack > spec - to ensure repack is still working while other backend are cancelled. I think we should perhaps commit spec tests for these (I've not yet reviewed them, but in principle), even before we fix the problem. It's good to document the current behavior and have a comment that the wrongly cancelled case should not trigger an error. Greetings, Andres Freund