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 1sUWNY-003eUB-5z for pgsql-admin@arkaria.postgresql.org; Thu, 18 Jul 2024 19:01:24 +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 1sUWNW-0032Jc-AI for pgsql-admin@arkaria.postgresql.org; Thu, 18 Jul 2024 19:01:22 +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 1sUWNV-0032IP-I9 for pgsql-admin@lists.postgresql.org; Thu, 18 Jul 2024 19:01:22 +0000 Received: from mail.network-systems-solutions.net ([162.250.175.178]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sUWNR-000EwZ-Eb for pgsql-admin@lists.postgresql.org; Thu, 18 Jul 2024 19:01:19 +0000 Received: from messaging.network-systems-solutions.net (unknown [192.168.242.37]) by mail.network-systems-solutions.net (Postfix) with ESMTP id A569D8143D for ; Thu, 18 Jul 2024 19:39:03 +0000 (UTC) Received: from aox (localhost [127.0.0.1]) by messaging.network-systems-solutions.net (Postfix) with ESMTP id 2F4EC8E05A0 for ; Thu, 18 Jul 2024 15:01:10 -0400 (EDT) Received: from jim@talentstack.to by aox (Archiveopteryx 3.2.0) with esmtpsa id 1721329269-3614-3610/6/43; Thu, 18 Jul 2024 19:01:09 +0000 Content-Type: multipart/alternative; boundary=------------TJOGvoUyt3WXIwHhKt1yhzD7 Message-Id: Date: Thu, 18 Jul 2024 14:59:35 -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 91335 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 --------------TJOGvoUyt3WXIwHhKt1yhzD7 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable On 18-Jul-2024 11:19, Paul Smith* wrote: > On 15/07/2024 19:47, Thomas Simpson wrote: >> >> My problem now is how do I get this space back to return my free=20 >> space back to where it should be? >> >> I tried some scripts to map the data files to relations but this=20 >> didn't work as removing some files led to startup failure despite=20 >> them appearing to be unrelated to anything in the database - I had to=20 >> put them back and then startup worked. >> > I don't know what you tried to do > > What would normally happen on a failed VACUUM FULL that fills up the=20 > disk so the server crashes is that there are loads of data files=20 > containing the partially rebuilt table. Nothing 'internal' to=20 > PostgreSQL will point to those files as the internal pointers all=20 > change to the new table in an ACID way, so you should be able to=20 > delete them. > > You can usually find these relatively easily by looking in the=20 > relevant tablespace directory for the base filename for a new huge=20 > table (lots and lots of files with the same base name - eg looking for=20 > files called *.1000 will find you base filenames for relations over=20 > about 1TB) and checking to see if pg_filenode_relation() can't turn=20 > the filenode into a relation. If that's the case that they're not=20 > currently in use for a relation, then you should be able to just=20 > delete all those files > > Is this what you tried, or did your 'script to map data files to=20 > relations' do something else? You were a bit ambiguous about that part=20 > of things. > [BTW, v9.6 which I know is old but this server is stuck there] Yes, I was querying relfilenode from pg_class to get the filename=20 (integer) and then comparing a directory listing for files which did not=20 match the relfilenode as candidates to remove. I moved these elsewhere (i.e. not delete, just move out the way so I=20 could move them back in case of trouble). Without these apparently unrelated files, the database did not start and=20 complained about them being missing, so I had to put them back.=C2=A0 = This=20 was despite not finding any reference to the filename/number in pg_class. At that point I gave up since I cannot afford to make the problem worse! I know I'm stuck with the slow rebuild at this point.=C2=A0 However, I = doubt=20 I am the only person in the world that needs to dump and reload a large=20 database.=C2=A0 My thought is this is a weak point for PostgreSQL so it = makes=20 sense to consider ways to improve the dump reload process, especially as=20 it's the last-resort upgrade path recommended in the upgrade guide and=20 the general fail-safe route to get out of trouble. Thanks Tom > Paul > > > --------------TJOGvoUyt3WXIwHhKt1yhzD7 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable


On 18-Jul-2024 11:19, Paul Smith* wrote:
On 15/07/2024 19:47, Thomas Simpson wrote:

My problem now is how do I get this space back to return my free space back to where it should be?

I tried some scripts to map the data files to relations but this didn't work as removing some files led to startup failure despite them appearing to be unrelated to anything in the database - I had to put them back and then startup worked.

I don't know what you tried to do

What would normally happen on a failed VACUUM FULL that fills up the disk so the server crashes is that there are loads of data files containing the partially rebuilt table. Nothing 'internal' to PostgreSQL will point to those files as the internal pointers all change to the new table in an ACID way, so you should be able to delete them.

You can usually find these relatively easily by looking in the relevant tablespace directory for the base filename for a new huge table (lots and lots of files with the same base name - eg looking for files called *.1000 will find you base filenames for relations over about 1TB) and checking to see if pg_filenode_relation() can't turn the filenode into a relation. If that's the case that they're not currently in use for a relation, then you should be able to just delete all those files

Is this what you tried, or did your 'script to map data files to relations' do something else? You were a bit ambiguous about that part of things.

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

Yes, I was querying relfilenode from pg_class to get the filename (integer) and then comparing a directory listing for files which did not match the relfilenode as candidates to remove.

I moved these elsewhere (i.e. not delete, just move out the way so I could move them back in case of trouble).

Without these apparently unrelated files, the database did not start and complained about them being missing, so I had to put them back.=C2=A0 This was despite not finding any reference to the filename/number in pg_class.

At that point I gave up since I cannot afford to make the problem worse!

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.

Thanks

Tom


Paul



--------------TJOGvoUyt3WXIwHhKt1yhzD7--