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 1teqSv-00FzHx-0P for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Feb 2025 07:01:53 +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 1teqSs-00AvOK-Vo for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Feb 2025 07:01:50 +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 1teqSs-00AvOC-LC for pgsql-hackers@lists.postgresql.org; Mon, 03 Feb 2025 07:01:50 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1teqSq-002uGN-0P for pgsql-hackers@postgresql.org; Mon, 03 Feb 2025 07:01:49 +0000 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-aaf900cc7fbso870435166b.3 for ; Sun, 02 Feb 2025 23:01:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1738566106; x=1739170906; darn=postgresql.org; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from:from:to:cc :subject:date:message-id:reply-to; bh=UqFg2YvG4zeZOd60/C7437w32FHB7vgeTiMWpeULyDg=; b=bm8lVTFCEI0OfLdtS/cTTUjMGpOiMqkqK4uetkFLdviphYLJNgf4hGD4utD5c3RRMR h2Hn9VnCUt6LmkpTp8t2WbOW76phNTrQg/2vzfmPuUh2U2r96daao8u5pYgYaThUlCBv Xqqay+9KKrw76r0lyRsWLidwkHnlruCdsxS/YopNNSSDaf2HR5zB/K3X7IpdXAt/9DB2 avJHRyppywSgb4cnnTw0akJoleGef8gl3HE8pl5jdqjaP61q0+zAIJoXG2s9bbCheaPt E5xGokiNWRaoBMtcmP3tkKs5dfCIT0dLQvlQFoFm2WmuWfGn8AL39/1BHafR4Kp99P17 oHbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738566106; x=1739170906; h=message-id:date:content-transfer-encoding:content-id: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=UqFg2YvG4zeZOd60/C7437w32FHB7vgeTiMWpeULyDg=; b=I5Q7UedMBJMSE8Af6BOV/wRNqCzBaRbJ6WESUw/UL1dqGOExK8EPrjWbpqF2XvKtBl 88Y/EP5IE4uXJluHct0wJ9PPc5C/hA1ogo08fQn9ZAM5aGvM31lNyEnYYS2MK+xJdtBu mA4+gpEW++EcWFeUHgSId44343huTEBm61mnqobkjKXGAg7f1oZMCwobBB48JaJrdC0b QNVkUL26L9+KQ/0V9dVfw12g/F8EgzdrBcF0RORSda2xXqdUQceeb3SaxITx458Cm392 sGLg1bHipiJHXmyyEJrumsfRWgrIxATUYVQJqcHGQuDT/UR4SUCiYz+Nm83ZzqiKPMEK PdUw== X-Forwarded-Encrypted: i=1; AJvYcCWfTIe73TY2IzFD5jTuuWrCZVQn9fevq3YHbVzdP+SAs5vj9Ysp0h2kbw2St2iDUhNgaezLopCWmtSFoYJM@postgresql.org X-Gm-Message-State: AOJu0Yx/u19eXCz1vRvBdtg1OuCCZXvQg+A6AtZzqVlJ3y+IvWCratj2 v+ruy2NRia0mtxqs0WwTvqETrTpsC58mfdT9Ot7EBhgxPlfa/5Zib2nvTOIw2Qw= X-Gm-Gg: ASbGncuT1hlO2GmfEKNhUNIH2eNpQdBu+032aW8+UTm7RhifljZIlXR2bRGFnskJxsk colockv2XsaxbHlPStR49EzaSqMUwWQ3w89+JX1p1TCTr4GazqUYJ1mmzpS/6LV28G3SyDKrsia RRxln1YgvIAqlxHLQMhfHfvBDZD80NzgHr1m8QCPU+6sUxIJk5tvTIwtmFW04cwiq31sJNJAeks u74oUOVwTpl5lzohER5DlsII0U9M2oUtrR27PLSZXq2Az6BNOUNUcf6Y1EOM3pPBc59axGkIy7l 0P+LhO7Y5xMazr0mVZQ= X-Google-Smtp-Source: AGHT+IHlOoMwjOlfklNKunijEwzBrqEo+Z9qRyvQGhOqNKOwfVp2xxt0DYXpJ47VwlZFtrtJbbhppA== X-Received: by 2002:a17:907:3e93:b0:aa6:3f93:fb99 with SMTP id a640c23a62f3a-ab6cfdbd147mr2403274366b.36.1738566106236; Sun, 02 Feb 2025 23:01:46 -0800 (PST) Received: from antos (109-81-174-36.rct.o2.cz. [109.81.174.36]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e4a320e0sm696716266b.151.2025.02.02.23.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2025 23:01:46 -0800 (PST) From: Antonin Houska To: Alvaro Herrera cc: Junwang Zhao , Kirill Reshke , Pavel Stehule , Michael Paquier , PostgreSQL Hackers Subject: Re: why there is not VACUUM FULL CONCURRENTLY? In-reply-to: <202502021321.6ul3axwpsklw@alvherre.pgsql> References: <202502021321.6ul3axwpsklw@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Sun, 02 Feb 2025 14:21:33 +0100." 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: <2878.1738566105.1@antos> Content-Transfer-Encoding: quoted-printable Date: Mon, 03 Feb 2025 08:01:45 +0100 Message-ID: <2879.1738566105@antos> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alvaro Herrera wrote: > = > = > > 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 C= LUSTER > > commands. > = > > @@ -950,8 +1412,46 @@ copy_table_data(Relation NewHeap, Relation OldHe= ap, 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 =3D 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. If this needs change, I prefer 2) because it's less invasive: 1) still aff= ects the progress monitoring code. I'll look at it. -- = Antonin Houska Web: https://www.cybertec-postgresql.com