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 1sUY9h-003uaH-Bf for pgsql-admin@arkaria.postgresql.org; Thu, 18 Jul 2024 20:55:13 +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 1sUY9f-004EJb-HW for pgsql-admin@arkaria.postgresql.org; Thu, 18 Jul 2024 20:55:11 +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 1sUY9f-004EG4-4h for pgsql-admin@lists.postgresql.org; Thu, 18 Jul 2024 20:55:11 +0000 Received: from mail.network-systems-solutions.net ([162.250.175.178]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sUY9X-000GTf-7X for pgsql-admin@lists.postgresql.org; Thu, 18 Jul 2024 20:55:10 +0000 Received: from messaging.network-systems-solutions.net (unknown [192.168.242.37]) by mail.network-systems-solutions.net (Postfix) with ESMTP id 340EF8143D for ; Thu, 18 Jul 2024 21:32:50 +0000 (UTC) Received: from aox (localhost [127.0.0.1]) by messaging.network-systems-solutions.net (Postfix) with ESMTP id 89D228E05A0 for ; Thu, 18 Jul 2024 16:54:56 -0400 (EDT) Received: from jim@talentstack.to by aox (Archiveopteryx 3.2.0) with esmtpsa id 1721336095-3615-3610/6/39; Thu, 18 Jul 2024 20:54:55 +0000 Content-Type: multipart/alternative; boundary=------------RVbB3CWM0f6FwWwPrSLKqHBd Message-Id: <7dee2c00-6184-49c5-b303-58113c1d04c6@talentstack.to> Date: Thu, 18 Jul 2024 16:53:23 -0400 Mime-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: filesystem full during vacuum - space recovery issues To: pgsql-admin@lists.postgresql.org References: Content-Language: en-CA From: Thomas Simpson In-Reply-To: X-NSSLTD-Archiving: Added to store 1 as 91336 X-Scanned-By: MIMEDefang 2.84 on 127.0.1.1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --------------RVbB3CWM0f6FwWwPrSLKqHBd Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable On 18-Jul-2024 16:32, Ron Johnson wrote: > On Thu, Jul 18, 2024 at 3:01=E2=80=AFPM Thomas Simpson wrote: > [snip] > > [BTW, v9.6 which I know is old but this server is stuck there] > > [snip] > > I know I'm stuck with the slow rebuild at this point. However, I > doubt I am the only person in the world that needs to dump and > reload a large database.=C2=A0 My thought is this is a weak point = for > PostgreSQL so it makes sense to consider ways to improve the dump > reload process, especially as it's the last-resort upgrade path > recommended in the upgrade guide and the general fail-safe route > to get out of trouble. > > =C2=A0No database does fast single-threaded backups. Agreed.=C2=A0 My thought is that is should be possible for a 'new = dumpall' to=20 be multi-threaded. Something like : * Set number of threads on 'source' (perhaps by querying a listening=20 destination for how many threads it is prepared to accept via a control=20 port) * Select each database in turn * Organize the tables which do not have references themselves * Send each table separately in each thread (or queue them until a=20 thread is available)=C2=A0 ('Stage 1') * Rendezvous stage 1 completion (pause sending, wait until feedback from=20 destination confirming all completed) so we have a known consistent=20 state that is safe to proceed to subsequent tables * Work through tables that do refer to the previously sent in the same=20 way (since the tables they reference exist and have their data) ('Stage = 2') * Repeat progressively until all tables are done ('Stage 3', 4 etc. as=20 necessary) The current dumpall is essentially doing this table organization=20 currently [minus stage checkpoints/multi-thread] otherwise the dump/load=20 would not work.=C2=A0 It may even be doing a lot of this for 'directory'=20 mode?=C2=A0 The change here is organizing n threads to process them=20 concurrently where possible and coordinating the pipes so they only send=20 data which can be accepted. The destination would need to have a multi-thread listen and co-ordinate=20 with the sender on some control channel so feed back completion of each=20 stage. Something like a destination host and control channel port to establish=20 the pipes and create additional netcat pipes on incremental ports above=20 the control port for each thread used. Dumpall seems like it could be a reasonable start point since it is=20 already doing the complicated bits of serializing the dump data so it=20 can be consistently loaded. Probably not really an admin question at this point, more a feature=20 enhancement. Is there anything fundamentally wrong that someone with more intimate=20 knowledge of dumpall could point out? Thanks Tom --------------RVbB3CWM0f6FwWwPrSLKqHBd Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable


On 18-Jul-2024 16:32, Ron Johnson wrote:
On Thu, Jul 18, 2024 at 3:01=E2=80=AFPM Thomas = Simpson <ts@talentstack.to> wrote:
[snip]

[BTW, v9.6 which I know is old but this server is stuck there]

[snip]=C2=A0

I know I'm stuck with the slow rebuild at this point.=C2= =A0 However, I doubt I am the only person in the world that needs to dump and reload a large database.=C2=A0 My = thought is this is a weak point for PostgreSQL so it makes sense to consider ways to improve the dump reload process, especially as it's the last-resort upgrade path recommended in the upgrade guide and the general fail-safe route to get out of trouble.

=C2=A0No database does fast single-threaded backups.

Agreed.=C2=A0 My thought is that is should be possible for a 'new dumpall' to be multi-threaded.

Something like :

* Set number of threads on 'source' (perhaps by querying a listening destination for how many threads it is prepared to accept via a control port)

* Select each database in turn

* Organize the tables which do not have references themselves

* Send each table separately in each thread (or queue them until a thread is available)=C2=A0 ('Stage 1')

* Rendezvous stage 1 completion (pause sending, wait until feedback from destination confirming all completed) so we have a known consistent state that is safe to proceed to subsequent tables

* Work through tables that do refer to the previously sent in the same way (since the tables they reference exist and have their data) ('Stage 2')

* Repeat progressively until all tables are done ('Stage 3', 4 etc. as necessary)

The current dumpall is essentially doing this table organization currently [minus stage checkpoints/multi-thread] otherwise the dump/load would not work.=C2=A0 It may even be doing a lot of this = for 'directory' mode?=C2=A0 The change here is organizing n threads to process them concurrently where possible and coordinating the pipes so they only send data which can be accepted.

The destination would need to have a multi-thread listen and co-ordinate with the sender on some control channel so feed back completion of each stage.

Something like a destination host and control channel port to establish the pipes and create additional netcat pipes on incremental ports above the control port for each thread used.

Dumpall seems like it could be a reasonable start point since it is already doing the complicated bits of serializing the dump data so it can be consistently loaded.

Probably not really an admin question at this point, more a feature enhancement.

Is there anything fundamentally wrong that someone with more intimate knowledge of dumpall could point out?

Thanks

Tom


--------------RVbB3CWM0f6FwWwPrSLKqHBd--