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 1w7djc-005YGm-02 for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2026 18:22:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7dja-00CFHy-1Z for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2026 18:22: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 1w7dja-00CFHq-0Z for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2026 18:22:38 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7djY-000000020h1-3KfX for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2026 18:22:37 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4887d4c6234so11807125e9.1 for ; Tue, 31 Mar 2026 11:22:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1774981355; x=1775586155; darn=lists.postgresql.org; h=message-id:date:content-transfer-encoding:mime-version:comments :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HKjAGyw6T88BZQD5pZejjfhPsjDxSdTEuCoJuS5I4I0=; b=SXy9HsvB6k/vB/YZPJ4lZUszEYlr4cLmTvBUBtzaSbShoaHS4V+W4CYYnq8qycuJt5 HHNtofuE19SeSmmRh2Cvuay0050gH0tcVrFSvt37vEpXZrxk4USnX/nLqDPGc76Bq4ym G+OkdBFTocG3WlU3VLlsiDP8A5jIno0KutUSvHY+u79Qu6FgrPV/usOn6xVpyMsjZH5q ydaYfek1nM5eHP/2SA7q0yIaMIijMRMNPfLHKErE4uUSzSPpMg/YNsNL2Tev0skbIYsu Di0ThndVA4DsDBF9npIk4YcEqG5HRVu70LEbhza94Ihx0xcad9Dr3dbQrsrEimXmyoD5 pONw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774981355; x=1775586155; h=message-id:date:content-transfer-encoding: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; bh=HKjAGyw6T88BZQD5pZejjfhPsjDxSdTEuCoJuS5I4I0=; b=fDtcrufofKUZz0M3KQIcw+plnmR6jW7sYIS9OfgXDryw1We5ZKzn6XJ0vQDMo0sele n5KAJDgVJjiM7A+qLRs02fegzWtAU9x7iYz9/ZhD6X9NqH4twhaR89osTM17o48+LxhT 9NkOaVbEbAosBGrxgBo4m+0hckxo6yMrP+4hT2KJFT7XAjXa6EOO+HOixsreHXi30zpS uh/8zT60M10/wruS7fyhZSZrXL+kj9kn8wZxqC7VtOcolgB3kOe3us/DAlbZATZjwAG0 m/EcyuNIh0H6VdTwyTLoCUpcwidu/iiKec2/k2vjz2znlP5x6zth051td5Mz97ysecjv SFcA== X-Forwarded-Encrypted: i=1; AJvYcCVCkpddCBjxdCxpGRxO+rE75YlVxL83m8xODfIgfQ83pJ8yxdW9GWWcCGQOnIOPL0mu9dUgn5Jyc5tV7kMG@lists.postgresql.org X-Gm-Message-State: AOJu0YxBHiuu01PW7sUrXTbyMnGOuATOG+1Sk0w+NrjhCWJhXgEyK05S YP0a+W0gu5pFK+OxiA6/k/dyoqXztRADoFHjHfUQeX1ELLKzKmeAnhwLGDyZ3znHQHc= X-Gm-Gg: ATEYQzxwnwAoeT1ED8WwCTlWggewTQaMLWuky3Te4vR7HIp7WUTQV3KNxCOkkZMYHah t2jVgnC9uRJMWa4+Xsx3k0ArGPKYNrXtMuQEJfomJ+ic2JTt0q4tLOsXszAY5B0EyWoydZr2dkR ZZBQokryim1ouiZfB2M2sUbmQuT8MrqIDEJTv1GMbLqFyye1L2HWKwO5Ydir+TLBieuo+5FuD9h jHiJgwy/nseqpRxK+T5xYvS/dRxfBYcDh+D+LDQ1eSoICFHkK8KHg5h4+GL5+rx1qAyAviL79T7 jGyEGoJHqCPWgXwmlQpwjR69X7CZsls8gaicOVEyrXH3fH2X5P0bKnn6lOy57k3akmKNEiPoCrw xUAHDo/5R63hLXb4k+R5AtfDhBgywUf9mVWs7XBurjpAdp7eN7ngCTE3LWrDjYrWAeOxKNBq3xw N9XwL9H2oMU8Z5wYGcIm93iL+r9tjkDuwRroet X-Received: by 2002:a05:600c:5303:b0:485:34b3:8587 with SMTP id 5b1f17b1804b1-48883562deamr7245365e9.10.1774981355251; Tue, 31 Mar 2026 11:22:35 -0700 (PDT) Received: from localhost (109-81-168-142.rct.o2.cz. [109.81.168.142]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4887c8bc9e7sm27264715e9.26.2026.03.31.11.22.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2026 11:22:34 -0700 (PDT) From: Antonin Houska To: Srinath Reddy Sadipiralla cc: Alvaro Herrera , Mihail Nikalayeu , Matthias van de Meent , Pg Hackers , Robert Treat Subject: Re: Adding REPACK [concurrently] In-reply-to: References: <202603252005.quy5h4oipoxd@alvherre.pgsql> Comments: In-reply-to Srinath Reddy Sadipiralla message dated "Tue, 31 Mar 2026 23:07:17 +0530." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 31 Mar 2026 20:22:33 +0200 Message-ID: <238425.1774981353@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Srinath Reddy Sadipiralla wrote: > On Thu, Mar 26, 2026 at 1:42=E2=80=AFAM Alvaro Herrera wrote: >=20 > As for lock upgrade, I wonder if the best way to handle this isn't to > hack the deadlock detector so that it causes any *other* process to die, > if they detect that they would block on REPACK. Arguably there's > nothing that you can do to a table while its undergoing REPACK > CONCURRENTLY; any alterations would have to wait until the repacking is > compelted. We can implement that idea simply enough, as shown in this > crude prototype.=20 >=20 > After testing this, I observed that it solves the scenario where a query = is waiting > on REPACK. For example, if a DROP TABLE requests an AEL and queues > behind REPACK's ShareUpdateExclusiveLock, the deadlock detector comes > when REPACK tries to upgrade to AEL, killing the DROP to prevent the circ= ular > queue deadlock, But the case I originally mentioned [1] was the reverse: = what > happens if a transaction already holds a lock that conflicts with the upc= oming > AEL upgrade (e.g., an analytical SELECT or an idle-in-transaction holding= an AccessShareLock), > but isn't waiting on REPACK at all? >=20 > In this case, there's no circular wait. The deadlock detector never fires= . REPACK > simply queues behind the SELECT, eventually hits its lock_timeout, aborts= and > cleans up. Why should the user set non-zero lock_timeout before running REPACK? --=20 Antonin Houska Web: https://www.cybertec-postgresql.com