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 1wEsg8-004Vv6-0H for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Apr 2026 17:45:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wEsg7-0045kn-0M for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Apr 2026 17:44:59 +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 1wEsg6-0045kd-2W for pgsql-hackers@lists.postgresql.org; Mon, 20 Apr 2026 17:44:58 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wEsg2-00000002APq-41Mt for pgsql-hackers@lists.postgresql.org; Mon, 20 Apr 2026 17:44:57 +0000 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-43d74086e5bso3327021f8f.0 for ; Mon, 20 Apr 2026 10:44:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1776707093; x=1777311893; darn=lists.postgresql.org; h=message-id:date:content-id:mime-version:comments:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=NnLbPjEaYZ617RYYmPnybc4BylrrZR+dQbaYW6yGD5Q=; b=fIzP59XzhcUbylunjDVwEjB6N5Bzzdg6WECWZqLpY4HCMUVg40pdu8amVBl5Qcm4uc iwqvPii2V45tS2ReztMwZ43WARgA1e+qB4uA0Q8371EL0iSSLh71mGqS4jX8rP2PWQUj iTqMJ86v239pca/GLjgmF0HgmpqyB549dHM8N6JDNejrNoIpcFnJTLBNIbRhkbuSKWx5 ePosXZwMCgI+pMQtJHiOihSCe1VNOW3C2wGgy8fS0Ajw62BdVuhspEAZMG203970bDEL kMILh5JOy291Yb/FpJQSMWhN+vBfuoEx9SVfat0UAcC+LAb8TJ+7XGzncYmwcNvrDi4f nhrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776707093; x=1777311893; h=message-id:date:content-id: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=NnLbPjEaYZ617RYYmPnybc4BylrrZR+dQbaYW6yGD5Q=; b=el+RubDZBe0OIOsXws4zwCS+xFzYlYY4bfQasDb/lrqojLJeHSdyTBux1ehBkke3LO G4TGeFZ9Pq9Kwzxf1pk+I2o2akZm8hw5l1+KD9MwOErGWZByC0oR5kGeGMKjZ1nw1GJQ 1KDKymal5nKVCNuJcXIHiDea+UVvFzvr/STxVpoIdemzaADNboAXaXJTt4sm/ITwKO4+ aNlmLj/Jooa72bIBlP1Ql0GsqPKLw/F/p61/f29CMeji1JN9IWITGall0R+1sONMBIyp qGFfLki0NpRJ2gRczgyML1uOhQ5NYenJDqiRDCXnawCJJLXNsQiSBMT4D+hj6bEzSLft Ijfg== X-Forwarded-Encrypted: i=1; AFNElJ8KGAlKeuupg+JU8RdFBLNaRQSanYnfAsrqFMevpUJ5czGQ1WZdDBoP9r76uu5Hc4Pkzc39BSVNKgn1N2Iz@lists.postgresql.org X-Gm-Message-State: AOJu0Yxa+7/CrVmapi+S6ZanhSEMAVvHcuymsZ6gl7cWOBINLNpD/vxI 8u5nknLLkmOcf96QzhiKUhz0Me2sJojyMCKn5rrloU8Z44S4FvCg34jf4ABXq0Imz3c= X-Gm-Gg: AeBDieuejb23npwNe2BFSf1ECcZGMTKNwy73Xk+abEiYJvGRWdBEJOlaUySU995j73s OpdeovVNoJ/UCHNvyMGLj2FM+x4iz428RkRTwrC1wyKzLJnMTleGbcosXOHpknE0lf2K2R7vO0Q imdOR0ZAjMFEJTIc1HLP3UUlXUPZaDseReJWbNf6jvTLOFm/hJarLbaQSPzztVBmJ5FZXX5Aq9y N41KcrDx710BRh0C1L5HPrKKzzdT51+kTS/zj1qjqetGuNrNigXyNvtlJKfIclYJfo6VBiAB95h mkbkQd+rjQRpljAGB6l7bH/e9RIDMN+wehFQjOvVELFsaLoJjPSsdhVQPKwA5QhDhIJlog0S3mP eDK0nhbHG7wQMlMRCubDiiKzaUqiw6CJ1rJgLMNO00iDOIG8gOKiKpmfWf7ZTOF58Vi1afGTSAP +YTSHjYGbPGfJKSxhLNQYV15vxK6WdcwfxtKfXnAagjYBnzNs= X-Received: by 2002:a05:6000:2482:b0:43f:ea25:c965 with SMTP id ffacd0b85a97d-43fea25c97bmr16935104f8f.32.1776707093460; Mon, 20 Apr 2026 10:44:53 -0700 (PDT) Received: from localhost (109-81-168-142.rct.o2.cz. [109.81.168.142]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4411c9f4f03sm1822730f8f.1.2026.04.20.10.44.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2026 10:44:52 -0700 (PDT) From: Antonin Houska To: Mihail Nikalayeu cc: Andres Freund , Amit Kapila , Alvaro Herrera , Srinath Reddy Sadipiralla , Matthias van de Meent , Pg Hackers , Robert Treat Subject: Re: Adding REPACK [concurrently] In-reply-to: References: <9539.1775724194@localhost> <112208.1776173876@localhost> <25514.1776264611@localhost> <38385.1776277704@localhost> <44458.1776540188@localhost> Comments: In-reply-to Mihail Nikalayeu message dated "Sun, 19 Apr 2026 00:46:00 +0200." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <68263.1776707092.1@localhost> Date: Mon, 20 Apr 2026 19:44:52 +0200 Message-ID: <68264.1776707092@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Mihail Nikalayeu wrote: > I've briefly looked at your patch. As I understand it, it cancels the other > process only when REPACK actually tries to upgrade the lock. ... > > AFAIU, Andres's concern is that the "victim" should be cancelled > sooner, rather than waiting until REPACK actually attempts the > upgrade. I thought the point is that the deadlock should be resolved in a controlled way, i.e. w/o relying on deadlock timeout. Once both processes sleep, the decision which one should be kicked off is effectively random. In other words, the actual deadlock IMO starts exactly at the moment both processes end up sleeping. But I may be wrong. -- Antonin Houska Web: https://www.cybertec-postgresql.com