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 1wEBG8-003l0g-2p for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Apr 2026 19:23:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wEBG6-00Dc7x-31 for pgsql-hackers@arkaria.postgresql.org; Sat, 18 Apr 2026 19:23:14 +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 1wEBG6-00Dc7o-1j for pgsql-hackers@lists.postgresql.org; Sat, 18 Apr 2026 19:23:14 +0000 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wEBG3-00000001s8p-3cKm for pgsql-hackers@lists.postgresql.org; Sat, 18 Apr 2026 19:23:13 +0000 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-43cfde3c3f3so1869138f8f.3 for ; Sat, 18 Apr 2026 12:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1776540190; x=1777144990; darn=lists.postgresql.org; h=message-id:date:mime-version:comments:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=lKedo4YYjzMFRlC+xT70+oqU6SYCbVBc3xUY+9mw3Zg=; b=RkCGzKOV11LpgH/sYZqj1L9yfuWZ7Ac8pC19jy0mCOzStBQAl9tcsQG37kSTcNqvn+ c0CKAxCIQL/154jy9NK14IJeltZ99nECqS6nvpleJDQFg1GjmLgEmqvRa4zHzxdUEHjS 2VLD5YjgG/8PVMVpDorBe87k6Plw17xsb+b+0cCpyubU64mC6OJAO/Mgzcu6f6GxWd0f bhOybkMZGN7xCEyhguRfhQQBLKrcnmle3CrCfXeG/2xYB7OX3R1fwJZV0E4ubL/snyzy 74oePKpm66TCJU7kCscfLdqIB2mMjoL+3TgM0nB5b1oB632PQwlCqAxJdSdvVBw1GAga he7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776540190; x=1777144990; h=message-id:date: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=lKedo4YYjzMFRlC+xT70+oqU6SYCbVBc3xUY+9mw3Zg=; b=ZBu5JO8NJhPOh5PI/DSTJs0kPY6/hv4TJwVTeGTNdPpQqzQW7vG/Gg8V8fbYxqqg1G 1P1OhDTuBqdQT3nMEoo/4dY8LGL0r0FXK/7CW9LU3IH0lEwFylfzHWythwM3DH8yXp+8 m3RVUJPtS+CjMZi4+2bZaVEvHDZTqdI2g01FDqWz7EkiR2Q2ih/RkxrFwOwRsNtpKp+i wZBuuZDAT7I5upz4xKoc2sym4tmLWPjXjfBmgVtT+E0mYRvLt89XEkpqhJndL1m8aW/2 zJRwdyCLp2TUaR783VBheGzDcPvSYVKos0/4Pj56evYbNq4JVtqKTeSzqEViiJUZX/dp OqgQ== X-Forwarded-Encrypted: i=1; AFNElJ/EkTN/FbRNBfi28V91bvP8YsQDlxERZ09WhJER17vb6TgKe8IjCVvy6PWKs+KGhV5osYDvgeGZyzVmnnCw@lists.postgresql.org X-Gm-Message-State: AOJu0Yx5z/DAdq0mcvP8BG3av8nN6K91woKG9/vtCLjXocTMPONLcsOU CMXldekhSwDDRCkhc7QoHKqM6dKyb839sM1D45Odz21IzcUlonKykgfAKQEhlqtw+wY= X-Gm-Gg: AeBDiev9lRU+iGJN+/CH7w37S3wfcXggwtlHnoUGdY0zzSNxNgyN5AJdvHLgECS3W6X tkC5a2JnnQBnXeyub0D1s06zAW/k3g6qMRl5iIeLkvPsQDRYt51L2eiZrqzHKL7LcO+Co22EVSw Lwbklso20aUd3I5MJIEuzwbvbyiOSbyO05xeLiztuMbLkyxZmYq3JIW7xnlZk7DtjFQ1PRFC44Z 0ebS0QXFEXt76xP1IQDn1y+luch2bk1zxtRfDt8/5obN7+VlPpYQ+X+UUVwKzmKdCwjsu8cBxP2 1a32PzGuYL4rI+FaAmAmd4EQb3H/n/hgEfvgut8dx/nQJE9u9QOHaOvgRPY/wDCd3/wZX36Yfgk KMt7pEpzx2dEuxUlBxzKZ8s4zYBRBE6NEj1NvtNXLbzFU4fIdkWLFNXrYXYJEhzIHqimcrdHEXa ndR2gVmOYmYHZ04AqAqg7p0feAt9oguG2vpGZHubjxcUo2d4w= X-Received: by 2002:a05:6000:22c5:b0:43c:f66e:f24 with SMTP id ffacd0b85a97d-43fe3e14e52mr11602851f8f.35.1776540189523; Sat, 18 Apr 2026 12:23:09 -0700 (PDT) Received: from localhost (109-81-168-142.rct.o2.cz. [109.81.168.142]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4e3a18csm16871472f8f.20.2026.04.18.12.23.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2026 12:23:08 -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> Comments: In-reply-to Mihail Nikalayeu message dated "Fri, 17 Apr 2026 04:01:00 +0200." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Date: Sat, 18 Apr 2026 21:23:08 +0200 Message-ID: <44458.1776540188@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=-=-= Content-Type: text/plain Mihail Nikalayeu wrote: > I think I got working POC for deadlock-detector enhancements for > REPACK (and potentially other). That looks interesting, I'll check it. I've also thought about the problem quite a bit this week. I tried to add a pointer to PGPROC that, like ->waitLock, points to the lock being acquired, but it's initialized before the actual waiting starts. I adjusted the deadlock detector to use that pointer too, but it did not work. The problem was probably that the lock wasn't in the queue during the check. Finally it occurred to me that a new field can be added to the LOCK structure, indicating that the lock is being upgraded. It enforces some extra deadlock checks by other processes, so that the upgrading process does not have to care about deadlock detection at all. More info in the commit message. It should handle all the cases in your tests, however a new injection point would be needed. (Not added yet.) -- Antonin Houska Web: https://www.cybertec-postgresql.com --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Lock-upgrade-without-deadlocks.patch