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 1w7s3A-005mLi-3C for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Apr 2026 09:39:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7s39-00GOmM-1Y for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Apr 2026 09:39:47 +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 1w7s39-00GOmE-0f for pgsql-hackers@lists.postgresql.org; Wed, 01 Apr 2026 09:39:47 +0000 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7s36-00000002KVn-3fOT for pgsql-hackers@lists.postgresql.org; Wed, 01 Apr 2026 09:39:47 +0000 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-38b13652c87so57884601fa.0 for ; Wed, 01 Apr 2026 02:39:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775036383; cv=none; d=google.com; s=arc-20240605; b=W6b4v7dfUrdWm97md6i+W28wLfwCMU7ImivIXUYSZlr4Rm4BPdTAIwBleLTxAm8VXg dZodG24El/JSxU0PMjCdR54SbDk54HvnGaGlp5jV4tSYIGvwYHOc1GOFv5PZTPA8BHhg zUd2xC77ZGtcq6GUClDt//UtYb57CBa4F9UvWRDYKTCbK+6YMlJwNHLVS+ss8rDJIWzv DtZsLNwn5V352sowKEpdFKhQbWgbJygdm6LXlR+R5hdysRRaWXBj9bevT42vj+41x+Im RziP9RM6aeFGlTPHvZxGAXRWnyD/FGIyGnIsmOOeudELwKWIURHtxbUdGdO4iMGmUgUA 6kjw== 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=eM0Z68bdu1yQUTLJAI+21p8N8PhxZ2nhsAR3dNmIFWM=; fh=m7mf2R3zAU3qaxEobhJH/WBek7EfYFbqSkzHgXGgbQc=; b=WEFz2X9mtcAWIldyBSRBvtTn6/IaxvVIKSIdc7LY1h9JID3Cra/TupC/CnAJwkEl0+ Q3YhO4Lj7L8yN33v1hyW/3KCHlzlJOyxU6K3tmLz8Ff9DkKIDADj0d6Azz+pOGL8UM5Y 5TzkEfOYxSTrRNq/wqo2JfgpmEsIA8HYsA216XEn2be7X4IffI7RGz24XWD4dnPc4V9/ v+Ki1ehFm7YHLUG46njN9ajzQ8oPv0lvrd9N3LuJfrAb/1yhj88Tkmz8FgNxRDK5uXdC VK6h8vVnxR67Z53VZg0nond9swsdVrHffdCcC0lRMYOZIfPkWpYicGW1fD40Qc13b6c9 FHfA==; 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=1775036383; x=1775641183; 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=eM0Z68bdu1yQUTLJAI+21p8N8PhxZ2nhsAR3dNmIFWM=; b=h8zfGGvrLgRmvl/5gERqLUPE6gT0bD9wc+CLl8Wd55fjEG5NruPJSytPyzvoqpP8l8 x5WeoZqrdzQe0Fbm+MM60TeQfDD6b2GKc3d2mvxC0w0e/PS6Oaq0eWhNnEpNxh8M/hLP /FsrqHY7tw25KAXfnqFUUinQoYIHLOC5Hmtdq660IHc65KksqVEuwYgSZMmbLGiSKkMT cdPbQIkRp9Zs2sXF3LFdaRu6tlQrI4qPIlbZvOx24uyuxCWEYADnUY/JvZpL2/D6QrtK +I+NALshMO1mJgot4t3/RGzgOU9YFIDWuNNXYFg+YL/5Kl5ZcHkLc1avSA/b/US6N1Tz XVMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775036383; x=1775641183; 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=eM0Z68bdu1yQUTLJAI+21p8N8PhxZ2nhsAR3dNmIFWM=; b=Tf/Eorpb6VDtM6BheU4MF4zrwfXk/ACvSIG1PifxXhy0xjpTY9JOnoiSqgfD/AC2A4 A2ZSGe2NZUe6cssm/2eLN6s/Nj4MxL2GfJOvaSam8ZI/O2NSNWt6JI1o8kllnl6zhs0q GMgoClBa4qCai9DgYAUf77H3x91Lt3cxMAsQdwRyU3fYqbug2UMcmGUfvKWfwIOObZ0j XnKC8JeeDtvfYCWsMfHMcyGMNeOR8Con5hKB7vB8IaOOeMNfuZJBLaKENF/6eUYkKMzC VGOcOJYM3nPgrIHAfYroVVOshuIGANRTWFXYUdoYd8xz5k+wLr3oz/VynCjuMOg2AHfe ilYA== X-Forwarded-Encrypted: i=1; AJvYcCWO4kFm8YnRETZkf6XCwuqR5/YHk/PGKjECch18kvbwPJi1tWcoXNV+IfRh9ElTOcTEFiFA6RtejysWa3sY@lists.postgresql.org X-Gm-Message-State: AOJu0YyvU2QQSD7TBvWg/tGaJmHp4AiN2+dHDucUUuxhYUrXucDTbjbw ivHFN3nCQ1osFnVpEO8Huvc8pcam2N1mrEUoXrRh9+cZEyY9+Y0RHHDeLEarSaq9mADg+QPBShk /EEQ3ykyxYibsyFxz4VF/JaATUk+iCvM= X-Gm-Gg: ATEYQzzVMjI92RwCXeaDZvXdlyBqmBaJvy8sGTmO3EP1ZIgjLL68aZIaGOLpvhYbnyz Fp9ZJdyLB5b+g42YapUpXVqqR3JAk1SvJy04A1ozNhFPdc6KRscD6G9YJYQFiwhkJNPJdGcjOGU zB4vZVQSGown9gAhW5BpnG1P8uc3S2Zf3cEL9WkjrSwlEvSs+UbJ7MrqMZNGkSK/g/nPZSAEspl LkHzlluBQxsEnweWuZvp/mtqeU/uGS+y24rbbpOkjEljdmmhSVUf1uV2ZDSOIU/WcTIWR48HWhK 853eyRMB9AOOUUozWikOD2eCF7z/8WLMD4HZRw== X-Received: by 2002:a05:651c:f0a:b0:38c:63df:82a6 with SMTP id 38308e7fff4ca-38cc30b7b2cmr10150121fa.29.1775036383221; Wed, 01 Apr 2026 02:39:43 -0700 (PDT) MIME-Version: 1.0 References: <202603311819.3gvgmupluxh2@alvherre.pgsql> In-Reply-To: <202603311819.3gvgmupluxh2@alvherre.pgsql> From: Amit Kapila Date: Wed, 1 Apr 2026 15:09:31 +0530 X-Gm-Features: AQROBzAxqGYcsp89wzxM6IFLhLuN1oQeb3zMETOJqkYU3DD8U5lngJQ8X7tWvJI Message-ID: Subject: Re: Adding REPACK [concurrently] To: Alvaro Herrera Cc: Srinath Reddy Sadipiralla , Mihail Nikalayeu , Antonin Houska , 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 Tue, Mar 31, 2026 at 11:54=E2=80=AFPM Alvaro Herrera wrote: > > On 2026-Mar-31, Srinath Reddy Sadipiralla wrote: > > > 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.Initially, I thought this cleanup > > was expected behavior. But after seeing your solution to protect > > REPACK from losing its transient table work, I thought it's "not > > expected". > > Yeah. Keep in mind that REPACK could have been running for many hours > or even days before it reaches the point of acquiring its AEL lock to do > the final swap; and it may well be critical work. We do not want to > lose it. So whatever is waiting to obtain a lock on the table, or > already has a lock on the table, has to yield. > > > If the goal is to prevent REPACK's work from being wasted, should we > > error out the backend that is making REPACK wait during the final swap > > phase? I am thinking of something conceptually similar to > > ResolveRecoveryConflictWithLock, actively cancelling the conflicting > > session to allow the AEL upgrade to proceed. > > Something like that might be appropriate, yeah. > What about if the blocking process is an autovacumm that is working to prevent XID wraparound? I think we already avoid killing it in such cases. BTW, one can say that cancelling a long-running report query also wastes a lot of effort of the user generating such a report. Why can't REPACK wait for such a select to finish instead of cancelling it? --=20 With Regards, Amit Kapila.