Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l7Rdc-0004OZ-K6 for pgsql-general@arkaria.postgresql.org; Wed, 03 Feb 2021 23:32:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l7Rdb-00044H-EZ for pgsql-general@arkaria.postgresql.org; Wed, 03 Feb 2021 23:32:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l7Rdb-00044A-7R for pgsql-general@lists.postgresql.org; Wed, 03 Feb 2021 23:32:43 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l7RdU-0006TT-Qv for pgsql-general@lists.postgresql.org; Wed, 03 Feb 2021 23:32:42 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1l7RdT-0002OL-NW; Wed, 03 Feb 2021 18:32:35 -0500 Date: Wed, 3 Feb 2021 18:32:35 -0500 From: Bruce Momjian To: Simon Windsor Cc: pgsql-general@lists.postgresql.org Subject: Re: Database upgrade Pg11 to Pg12 issues Message-ID: <20210203233235.GA11064@momjian.us> References: <8e6d09bd-d992-e6da-b3bd-a32670f94fac@cornfield.me.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8e6d09bd-d992-e6da-b3bd-a32670f94fac@cornfield.me.uk> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Feb 3, 2021 at 11:25:11PM +0000, Simon Windsor wrote: > Hi > > I have upgraded many Pg databases from 9 to 10 to 11 using the Ubuntu > pg_upgradecluster command (wrapper to pg_update) without issues, however today > I upgraded a DB from 11 to 12. > > Using the syntax > > pg_upgradecluser -k -m upgrade 11 main > > using the latest 12.5 binaries all appeared to work well, and for a 330G DB > this took 2 minutes. On starting the DB using > > systemctl start postgresql@12.service > > the DB started, but the screen showed the default directory was /var/lib/ > postgresql/11/main. Checking the open database with > > show data_directory; gave /var/lib/postgresql/12/main > > Then using lsof | grep '11/main' gave no files, but lsof | grep '12/main' gave > over 30K files, Checking the directory sizes suggests that 11/main is 300G and > 12/main is 40G This doesn't make sense to me. Since we hard-linked, why would 12 be so much smaller? If it was symlinks, I could imaging that, but it doesn't use symlinks, just hard links, so it should be similar. Please look at the size of main/base on both, since that is where your data is. Maybe 11 just has a lot of old WAL that isn't copied. > So all appears OK, with files hard linked between 11/main and 12/main, and I > assume the issue relates to the PGDATA/postgresql.auto.conf file being just > copied from the original 11/main with data_directory being set to /var/lib/ > postgresql/11/main. > > If I where to run pg_dropcluster 11 main to remove the old database and conf > files, will this destroy my running Pg12 database with hard linked files in 11/ > main and 12/main? In theory it shouldn't and files from 11/main and 12/main > will all be under 12/main, I just have doubts. > > Is there an easy way to tidy this up? Yes, if the sizes made sense, removing 11 would be fine, but right now, it doesn't sound right. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee