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 1teZv0-00EOHx-Bb for pgsql-hackers@arkaria.postgresql.org; Sun, 02 Feb 2025 13:21:47 +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 1teZuz-007ELU-0Z for pgsql-hackers@arkaria.postgresql.org; Sun, 02 Feb 2025 13:21:45 +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.94.2) (envelope-from ) id 1teZuy-007ELL-9b for pgsql-hackers@lists.postgresql.org; Sun, 02 Feb 2025 13:21:44 +0000 Received: from fhigh-a2-smtp.messagingengine.com ([103.168.172.153]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1teZuu-002rSO-0d for pgsql-hackers@postgresql.org; Sun, 02 Feb 2025 13:21:43 +0000 Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfhigh.phl.internal (Postfix) with ESMTP id DED10114011B; Sun, 2 Feb 2025 08:21:36 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Sun, 02 Feb 2025 08:21:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1738502496; x=1738588896; bh=4 Hi+13bWOX7LmgmgiLhVZhebO9NI4GedcXcrQ6ncs/c=; b=CKwROYpER4ZVFkHNi XU+H6gLeaDou6RladLGdiYT2V0Hvy4wEkp6Pfx7Nlz2QW17KEIBrB+PxHvr2+xIa vELqU2GC0ga2MBLpBe7mUGMqdeGkFvIcQo2oJsLR7UyX5Fq0iJZQhSCElGGSemTs mR/hM382pPqGBWQ8u9TMfzB7YYrWUwN8cg9QBpqU+0vtApCOODb1GBUA0Oo0YwjG JUhqax5ee2+CZSTqdko6tHkYn4Pzph8mZVzJo62Z20kRDGWvJlL1pn2GaESqfj4s SHQyH0ACJOCSbtZuqD/l6uS0N3O7ecmfhLpGckwyn0vJrcxpdKg2eYK5mNGdy4WP AnOCg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddugeejjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdej necuhfhrohhmpeetlhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvh hhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpedvkedtffduffdtffffheff hfejjefhgfeiueeukeejkeffgfdufffhudffffeuveenucffohhmrghinhepvghnthgvrh hprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrghdpnhgspg hrtghpthhtohepiedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheprghhsegthigs vghrthgvtgdrrghtpdhrtghpthhtohepphgrvhgvlhdrshhtvghhuhhlvgesghhmrghilh drtghomhdprhgtphhtthhopehrvghshhhkvghkihhrihhllhesghhmrghilhdrtghomhdp rhgtphhtthhopeiihhhjfihpkhhusehgmhgrihhlrdgtohhmpdhrtghpthhtohepmhhitg hhrggvlhesphgrqhhuihgvrhdrgiihiidprhgtphhtthhopehpghhsqhhlqdhhrggtkhgv rhhssehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 2 Feb 2025 08:21:36 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1738502493; bh=tIjGmlZtpcSSPu01cPM8gozklrlMfxRBLlrlcyeZYIw=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=AjUMiutYSGBZnbKxsWXYYaRSq5oaxOEa7D+0WWbfeF9OLsnUF0AQDdTeZyVIYpMR7 oOVwhGgsMnQmOJzPOrUv/vewm8suLWrbAXqCQola6Pw1lAcLXEphStkUBxuhq+7mM8 z6ijFj7cQWEjSri9vE0RMOBhMlTT8pk4x2lCBX3ed2F0OxoMK38pey8aqavPiVzy6I ypKHhgWEhzpdvN717TbnKgFwkJi5caq+KvhLbdtHgqjHYVNRdySsQjI4Tk1HHyvWlS fsgIrPgBrmBZ0t2ojHb1HwgoenVayO/S6gc+0ku10ebZt0VlvJois5rlX/acxIPM+o T62z1M4z4U9Gw== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 92BEF8F; Sun, 2 Feb 2025 14:21:33 +0100 (CET) Date: Sun, 2 Feb 2025 14:21:33 +0100 From: Alvaro Herrera To: Antonin Houska Cc: Junwang Zhao , Kirill Reshke , Pavel Stehule , Michael Paquier , PostgreSQL Hackers Subject: Re: why there is not VACUUM FULL CONCURRENTLY? Message-ID: <202502021321.6ul3axwpsklw@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6250.1736776111@antos> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > From bf2ec8c5d753de340140839f1b061044ec4c1149 Mon Sep 17 00:00:00 2001 > From: Antonin Houska > Date: Mon, 13 Jan 2025 14:29:54 +0100 > Subject: [PATCH 4/8] Add CONCURRENTLY option to both VACUUM FULL and CLUSTER > commands. > @@ -950,8 +1412,46 @@ copy_table_data(Relation NewHeap, Relation OldHeap, Relation OldIndex, bool verb > + if (concurrent) > + { > + PgBackendProgress progress; > + > + /* > + * Command progress reporting gets terminated at subtransaction > + * end. Save the status so it can be eventually restored. > + */ > + memcpy(&progress, &MyBEEntry->st_progress, > + sizeof(PgBackendProgress)); > + > + /* Release the locks by aborting the subtransaction. */ > + RollbackAndReleaseCurrentSubTransaction(); > + > + /* Restore the progress reporting status. */ > + pgstat_progress_restore_state(&progress); > + > + CurrentResourceOwner = oldowner; > + } I was looking at 0002 to see if it'd make sense to commit it ahead of a fuller review of the rest, and I find that the reason for that patch is this hunk you have here in copy_table_data -- you want to avoid a subtransaction abort (which you use to release planner lock) clobbering the status. I think this a bad idea. It might be better to handle this in a different way, for instance 1) maybe have a flag that says "do not reset progress status during subtransaction abort"; REPACK would set that flag, so it'd be able to continue its business without having to memcpy the current status (which seems like quite a hack) or restoring it afterwards. 2) maybe subtransaction abort is not the best way to release the planning locks anyway. I think it might be better to have a ResourceOwner that owns those locks, and we do ResourceOwnerRelease() which would release them. I think this would be a novel usage of ResourceOwner so it needs more research. But if this works, then we don't need the subtransaction at all, and therefore we don't need backend progress restore at all either. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/