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.94.2) (envelope-from ) id 1tvvPA-0099tW-7h for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Mar 2025 09:44:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tvvOA-009vTA-SL for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Mar 2025 09:43:34 +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.94.2) (envelope-from ) id 1tvvOA-009vQm-Hj for pgsql-hackers@lists.postgresql.org; Sat, 22 Mar 2025 09:43:34 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tvvO8-000TWv-2Z for pgsql-hackers@postgresql.org; Sat, 22 Mar 2025 09:43:33 +0000 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-3914aba1ce4so2305988f8f.2 for ; Sat, 22 Mar 2025 02:43:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1742636611; x=1743241411; darn=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=g3ZhMVaS5QKqcRROdy0L8MPQiMwySO9uWa43n3/husA=; b=nWpP5oMAUpSMNntHGjuZpkVnhTc0dCtwpPkzlydXCJDI2bUVr/YD4wwIUQFi1UIZNQ aiEXMjtPV7VtGvlPOggAWPLI67zKSKD/nFXucG3wt5y7q7VGIFPXvW9G3Jpx0aclA9R2 DFkXIPZfwLczPQ5qSt6BG8h5J5Q/ucXWiMVhKLew133bMuTMEqaiUPgnCVJTMjgWKIOg bTbRBsaTIzHq33gtUbkkde7Ym7p26AcXx8QdAhHsbY+PmFX/N/2KvKbocdTQhBSMmfYP yCwDAVZ1Aa2z8WngWDb6yt9R3u7G2ZEcOhvwpzTln55iEwc7xcyvmoc0kvrACqEyxP2U 8LgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742636611; x=1743241411; h=message-id:date:content-transfer-encoding:mime-version:comments :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=g3ZhMVaS5QKqcRROdy0L8MPQiMwySO9uWa43n3/husA=; b=VEl8O8gzIYB4WcqCfGCUPV+Ik+Uqx4JpwZ8Bgc4iDrWzDWsmEPnxeMyWBvu/dxqA8R 580zWUSV67lwRhOBZf6blgY7fKPxXDC0cyd1xdF7rwo8BMiS8cTR6b0ZTjH+qSf4MrxZ B1WvBlslvcn1JojjRQnzztVvFdOEbhzEzDTF2MTTTWKZr/XjJkYPLdBLJgoHFQyYYQou 5JofNhuvDlLlN/ycdellldrmw/r2hVALWRTg6Ard77F1qQl9wMzzNSXsXcQJYFqmFChO rLTMVpXEtQtTq+8cXArjsvO4qwMCJ5Tvm65BC6HlqcKColvOE6PR5OG5iUZhxIMAktx9 gj7g== X-Forwarded-Encrypted: i=1; AJvYcCUzDl/xZdNZOcsZU7cYjq45rTop5/eCkrgzwQDt4UANS4cQnngy+SVysQx+KmNdx2TxWuHE3whxyGqv6FXP@postgresql.org X-Gm-Message-State: AOJu0YzgKuRTZVnKI6U3IvvY/klKXBx1yfRZf9QmMhRaZ44ZFk9tX9oC kg7MesVMz0bml+Gi4U1Fi1FM9p3TfXDL+WGR/P8f79sMhQcg9bCU38wGXynH2h0= X-Gm-Gg: ASbGncsfwZVOqHGys+YmFGhmusxt8UZvzxzowDmNq2ht14aOJARK+9Ih8pf4nV5PsyK HPYhUjIw9q8hsIP/e86v1ZDYa2f79BpVE8a55z0Vd3b2OJJGMDYkAOgUyXulmdI/ohz2pXIhkwM IABf2pyTlL6aTs2XJyjbhWlEUjrLJib4E2+3+SchbSWYbxmXZtr41xaFVqFzlrmPsWvqtT/mitc x7JHzq3jrlX+OJs3WsJuQP6HJHy4WponxSsQxrK87mRGIPrO6Nvc+gfxXt2LXUViKBV9rmWDj8Y FNo4GC3AJ0pOYPpobzkqk/uvlCzsfE8qH8a9sHpZ6EmlM2i4bIKw7MQz X-Google-Smtp-Source: AGHT+IFZtiklCU3TU9sZiTN92yx6PSI2IGbX1aezDayxMyVdAg0/SwymL7fKPeoED8GzdZrZ0OPI/w== X-Received: by 2002:a05:6000:1543:b0:390:f987:26a1 with SMTP id ffacd0b85a97d-3997f911531mr6151134f8f.29.1742636610866; Sat, 22 Mar 2025 02:43:30 -0700 (PDT) Received: from localhost (109-81-174-36.rct.o2.cz. [109.81.174.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9b5b8dsm4756154f8f.59.2025.03.22.02.43.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Mar 2025 02:43:30 -0700 (PDT) From: Antonin Houska To: Robert Haas cc: Alvaro Herrera , Marcos Pegoraro , Michael Banck , Junwang Zhao , Kirill Reshke , Pavel Stehule , Michael Paquier , PostgreSQL Hackers Subject: Re: why there is not VACUUM FULL CONCURRENTLY? In-reply-to: References: <127361.1740559688@localhost> <202503201732.xyyic3z35zis@alvherre.pgsql> <128545.1742494193@localhost> Comments: In-reply-to Robert Haas message dated "Thu, 20 Mar 2025 14:32:49 -0400." 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: Sat, 22 Mar 2025 10:43:29 +0100 Message-ID: <7221.1742636609@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas wrote: > On Thu, Mar 20, 2025 at 2:09=E2=80=AFPM Antonin Houska w= rote: > > Robert Haas wrote: > > > Is there a README or a long comment in here someplace that is a good > > > place to read to understand the overall design of this feature? > > > > I tried to explain how it works in the commit messages. The one in 0004= is > > probably the most important one. >=20 > Thanks. A couple of comments/questions: >=20 > - I don't understand why this commit message seems to think that we > can't acquire a stronger lock while already holding a weaker one. We > can do that, and in some cases we do precisely that. Can you please give me an example? I don't recall seeing a lock upgrade in = the tree. That's the reason I tried rather hard to avoid that. > Such locking > patterns can result in deadlock e.g. if I take AccessShareLock and you > take AccessShareLock and then I tried to upgrade to > AccessExclusiveLock and then you try to upgrade to > AccessExclusiveLock, somebody is going to have to ERROR out. But that > doesn't keep us from doing that in some places where it seems better > than the alternatives, and the alternative chosen by the patch > (possibly discovering at the very end that all our work has been in > vain) does not seem better than risking a deadlock. I see. Only the backends that do upgrade their lock are exposed to the risk= of deadlock, e.g. two backends running REPACK CONCURRENTLY on the same table, = and that should not happen too often. I'll consider your objection - it should make the patch a bit simpler. > - On what basis do you make the statement in the last paragraph that > the decoding-related lag should not exceed one WAL segment? I guess > logical decoding probably keeps up pretty well most of the time but > this seems like a very strong guarantee for something I didn't know we > had any kind of guarantee about. The patch itself does guarantee that by checking the amount of unprocessed = WAL regularly when it's copying the data into the new table. If too much WAL appears to be unprocessed, it enforces the decoding before the copying is resumed. The WAL decoding during the "initial load" phase can actually be handled by= a background worker (not sure it's necessary in the initial implementation), which would make a significant lag rather unlikely. But even then we should probably enforce certain limit on the lag (e.g. because background worker is not guaranteed to start). > - What happens if we crash? The replication slot we create is RS_TEMPORARY, so it disappears after restart. Everything else is as if the current implementation of CLUSTER ends due to crash. --=20 Antonin Houska Web: https://www.cybertec-postgresql.com