Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ghsr0-0007a0-Ei for pgsql-bugs@arkaria.postgresql.org; Fri, 11 Jan 2019 09:11:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ghsqz-00030r-44 for pgsql-bugs@arkaria.postgresql.org; Fri, 11 Jan 2019 09:11:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ghoXS-0001CQ-J8 for pgsql-bugs@lists.postgresql.org; Fri, 11 Jan 2019 04:35:22 +0000 Received: from pecan2-mail.exetel.com.au ([220.233.0.71] helo=pecan2.exetel.com.au) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ghoXI-0003Qe-AE for pgsql-bugs@lists.postgresql.org; Fri, 11 Jan 2019 04:35:19 +0000 Received: from [220.233.7.36] (helo=bunyip.billabong.weebeastie.net) by pecan2.exetel.com.au with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ghoXA-0004o7-Vq; Fri, 11 Jan 2019 15:35:05 +1100 Received: from hogarth by bunyip.billabong.weebeastie.net with local (Exim 4.89) (envelope-from ) id 1ghoX9-0007af-JL; Fri, 11 Jan 2019 15:35:03 +1100 Date: Fri, 11 Jan 2019 15:35:03 +1100 From: AP To: Andres Freund Cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15582: ALTER TABLE/INDEX ... SET TABLESPACE does not free disk space Message-ID: <20190111043503.7hgftwquyx7fnego@zip.com.au> References: <15582-dae8ba537137883d@postgresql.org> <20190109160728.cmcnkf4x2hnqb4lr@alap3.anarazel.de> <20190110035821.x54pyf4krnri2u4s@zip.com.au> <20190110082200.ftx5id3xafhuoykg@zip.com.au> <20190110230346.snzryafjyznqxncc@zip.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190110230346.snzryafjyznqxncc@zip.com.au> User-Agent: NeoMutt/20170113 (1.7.2) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Jan 11, 2019 at 10:03:46AM +1100, AP wrote: > On Thu, Jan 10, 2019 at 07:22:00PM +1100, AP wrote: > > > > I suspect the issue is that we don't properly close the old relation in > > > > all backends that had it open, but it's hard to know for sure without > > > > that. If restarting isn't feasible, ensuring all backends older than > > > > the move are ended, and issuing a CHECKPOINT; might also free the space > > > > after a few seconds. > > > > > > I did a CHECKPOINT (it was fast) and it did not help. Then I did a restart > > > and space is still used. > > > > I tried it again (because I need to write data to the db ASAP) with other > > tables that are actively being written to (the previous lot were "archived" > > tables) and I noticed this in the logs: > > > > ERROR: [082]: unable to push WAL segment '00000001000117BB00000001' asynchronously after 60 second(s) > > 2019-01-10 19:06:25.753 AEDT [21662] LOG: archive command failed with exit code 82 > > 2019-01-10 19:06:25.753 AEDT [21662] DETAIL: The failed archive command was: pgbackrest --stanza=zonk archive-push pg_wal/00000001000117BB00000001 > > So I restarted this ALTER to the new tablespace and let it complete. This time > it freed disk space on the source (the above errors kept happening, though). > > The original 5.5TB, though, is still duplicated and now I've a DB bigger than > the original storage can contain. :( Thanks for your help on IRC. Just to tidy up here: it was PEBCAK. I left the old 10 db dir lying around after a linked pg_upgrade to 11. :( Realised what was going on after Andres asked the magic question. I now have 12TB free on the old tablespace, which makes sense. Apologies for the hassle to one and all. AP