Thread: Linked data from upgrade after VACUUM FULL not deleted.

Linked data from upgrade after VACUUM FULL not deleted.

From
Josef Šimánek
Date:
Hello.

Few months ago we did successful pg_upgrade --link from 9.6 to 10. I did a VACUUM FULL of all database this weekend and data from 9.6 directory were not released.

I have tablespace with only one database.

PostgreSQL 10 folder has similar size to actual database size (by https://wiki.postgresql.org/wiki/Disk_Usage it is 660GB):
681G    ./postgres_raid_tablespace/PG_10_201707211

PostgreSQL 9.6 folder still has a lot of data in there:
547G    ./postgres_raid_tablespace/PG_9.6_201608131

I did a really naive check if any links are still present:

ls -la . | grep "\->"

And nothing was found.

I have checked also which files are waiting to be deleted via lsof -u postgres, but nothing was found in those directories.

I'm wondering if I understand this well and this is expected state where old folder is not touched anymore and that's the reason why VACUUM FULL is not releasing space in there.

Is there any way how to check if anything in that folder is really not used anymore and consider that safe to delete?

I'll appreciate any suggestions.

Josef

Re: Linked data from upgrade after VACUUM FULL not deleted.

From
Bruce Momjian
Date:
On Sat, May 11, 2019 at 07:04:32PM +0200, Josef Šimánek wrote:
> Hello.
> 
> Few months ago we did successful pg_upgrade --link from 9.6 to 10. I did a
> VACUUM FULL of all database this weekend and data from 9.6 directory were not
> released.
> 
> I have tablespace with only one database.
> 
> PostgreSQL 10 folder has similar size to actual database size (by https://
> wiki.postgresql.org/wiki/Disk_Usage it is 660GB):
> 681G    ./postgres_raid_tablespace/PG_10_201707211
> 
> PostgreSQL 9.6 folder still has a lot of data in there:
> 547G    ./postgres_raid_tablespace/PG_9.6_201608131
> 
> I did a really naive check if any links are still present:
> 
> ls -la . | grep "\->"

They are _hard_ links and do not show up as ->, but as the _link_ count,
which is the second column of ls -la.

> And nothing was found.
> 
> I have checked also which files are waiting to be deleted via lsof -u postgres,
> but nothing was found in those directories.
> 
> I'm wondering if I understand this well and this is expected state where old
> folder is not touched anymore and that's the reason why VACUUM FULL is not
> releasing space in there.
> 
> Is there any way how to check if anything in that folder is really not used
> anymore and consider that safe to delete?
> 
> I'll appreciate any suggestions.

They is an output line of pg_upgrade which says:

    Running this script will delete the old cluster's data files:

In summary, you can delete the old data directory.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +