Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VlQK4-0004tz-Gi for pgsql-bugs@arkaria.postgresql.org; Tue, 26 Nov 2013 21:37:32 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VlQK3-00079M-W6 for pgsql-bugs@arkaria.postgresql.org; Tue, 26 Nov 2013 21:37:32 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VlPKL-0002Me-UZ for pgsql-bugs@postgresql.org; Tue, 26 Nov 2013 20:33:46 +0000 Received: from mail-pd0-x22c.google.com ([2607:f8b0:400e:c02::22c]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VlPKI-0001R7-8n for pgsql-bugs@postgresql.org; Tue, 26 Nov 2013 20:33:45 +0000 Received: by mail-pd0-f172.google.com with SMTP id g10so8456785pdj.3 for ; Tue, 26 Nov 2013 12:33:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mirthcorp.com; s=google; h=mime-version:subject:from:in-reply-to:date:cc:message-id:references :to:content-type; bh=qohxBiIapWZKzBdlvyt4EBV5ZMwFOkr/mdaF03u3vX4=; b=Dv/mUsErS4JxNCUhm3EQbWbN4k5VCvpd/XgLdkTVCJMvcTTubhKtxV31VTQRHiIROp lxtFq0IAtxa3KHLCCRBJLsLO8LyPE5EO6696qke59Q4YrzQDjJN7hTRXRxHCRcUr3fyj GPKloivzeTxyrqZaybQbk+6sSbqzn/XlJf4LE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to:content-type; bh=qohxBiIapWZKzBdlvyt4EBV5ZMwFOkr/mdaF03u3vX4=; b=WiBu8PLY6EwWGzFBz7V7vU1P8ga2ejl/GMcNv7wVo4Io01ibf7LJ/DHnDZtOIbjEqa 9yONru79x2OOaqJjyRXky8zfP8VU4acRy5pD7+fIkbco4ScI02mz0nVXQuXXJm1XMLLy iVNWeVAq2coCEJibFL0w0i5hiberCMQKX2f7DkWsZDdxZdvqwvtc5nkfcWAk2Gwdo7ne lBQcEPSJR9foRW4XEwSu4EVUoOadb+AT+nt2BdjMH0AoYCEoZjkpOKbdGcSG4aaPr1UQ bGg/g8avUSaGaYS33efqhLaYvuBIzNQzsTJgfeGHuB3TlvbhRtzRrnALH27h8M/drRgA gQOA== X-Gm-Message-State: ALoCoQkNdZjtdabOSg2zeBL5272Lj5bCPgiwb7pjmQRmTpiL7SHctaufGGM+d64jfdMABbxL8aYpctv3ZdzuHw24DhQkxfajiFHTN082CB0880Hugg0GPV0= X-Received: by 10.66.246.229 with SMTP id xz5mr12933434pac.128.1385498020945; Tue, 26 Nov 2013 12:33:40 -0800 (PST) Received: from eduardos-imac.hq.mirthcorp.com (wsip-70-183-27-154.oc.oc.cox.net. [70.183.27.154]) by mx.google.com with ESMTPSA id iu7sm82694773pbc.45.2013.11.26.12.33.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 12:33:40 -0800 (PST) Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Subject: Re: BUG #8612: Truncate did not release disk space From: Eduardo Armendariz In-Reply-To: Date: Tue, 26 Nov 2013 12:33:38 -0800 Cc: Stefan Kaltenbrunner , Pg Bugs Message-Id: References: <528FAC9A.6010801@kaltenbrunner.cc> To: Jeff Janes X-Mailer: Apple Mail (2.1510) Content-Type: multipart/alternative; boundary="Apple-Mail=_51DAFEDD-087B-491A-8652-8B97E81D4659" X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --Apple-Mail=_51DAFEDD-087B-491A-8652-8B97E81D4659 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1 Some of the data was still in the base directory which corresponded to the = table that was truncated.=20 Unfortunately, this was somewhat of a time sensitive issue so I did end up = dropping the whole database and recreating it. That did clear the disk spac= e which was originally left behind from the truncate. I don't really have t= he means to reproduce this. The only application that had connections open = with the database was down at the time of the truncate. The only thing out = of the ordinary was that there was very little disk space left when I attem= pted to truncate. Thanks, Eduardo Armendariz On Nov 22, 2013, at 12:04 PM, Jeff Janes wrote: > On Fri, Nov 22, 2013 at 11:12 AM, Stefan Kaltenbrunner wrote: > On 11/20/2013 08:35 PM, eduardoa@mirthcorp.com wrote: > > The following bug has been logged on the website: > > > > Bug reference: 8612 > > Logged by: Eduardo Armendariz > > Email address: eduardoa@mirthcorp.com > > PostgreSQL version: 9.0.13 > > Operating system: CentOS > > Description: > > > > Ran out of disk space and postgres shut down. Recovered enough disk spa= ce > > for database to be operational. Truncated the largest table in the data= base, > > the message table. This table had over 600gb of data. The result of the > > truncate was that only about 200gb of the data was actually released to= the > > OS. >=20 > sure that no other backend was/is actually still a file-handle > referenced? That open filehandle will prevent the OS from showing up the > freed space on the filesystem and can happen if you have backends still > running that once referenced the table now truncated and have not done > any work since you did the truncate (like a large connection pool or > idle client connections, maybe an open psql session or something like tha= t). >=20 > If that were the case, I don't think pg_database_size would still be coun= ting the size, as it would no longer be able to find it the files in that d= irectory. >=20 > I think the next step would be to get an 'ls -l' listing of the $PGDATA/b= ase/ directory. >=20 > Cheers, >=20 > Jeff --=20 CONFIDENTIALITY NOTICE: The information contained in this electronic=20 transmission may be confidential. If you are not an intended recipient, be= =20 aware that any disclosure, copying, distribution or use of the information= =20 contained in this transmission is prohibited and may be unlawful. If you=20 have received this transmission in error, please notify us by email reply= =20 and then erase it from your computer system. --Apple-Mail=_51DAFEDD-087B-491A-8652-8B97E81D4659 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 Some of the data was st= ill in the base directory which corresponded to the table that was truncate= d. 

Unfortunately, this was somewhat of a time sens= itive issue so I did end up dropping the whole database and recreating it. = That did clear the disk space which was originally left behind from the tru= ncate. I don't really have the means to reproduce this. The only applicatio= n that had connections open with the database was down at the time of the t= runcate. The only thing out of the ordinary was that there was very little = disk space left when I attempted to truncate.

Than= ks,
Eduardo Armendariz

On Nov 22, 2013, a= t 12:04 PM, Jeff Janes <jeff.jan= es@gmail.com> wrote:

On Fri, Nov 22, 2013 at 11:12 AM, Stefan Kaltenbrunner = <stefan@kaltenbrunner.cc> wrote:
On 11/20/2013 08:35 PM, eduardoa@mirthcorp.com wrote:
> The following bug has been logged on the website:
>
> Bug reference:      8612
> Logged by:          Eduardo Armendariz
> Email address:      eduardoa@mirthcorp.com
> PostgreSQL version: 9.0.13
> Operating system:   CentOS
> Description:
>
> Ran out of disk space and postgres shut down. Recovered enough disk sp= ace
> for database to be operational. Truncated the largest table in the dat= abase,
> the message table. This table had over 600gb of data. The result of th= e
> truncate was that only about 200gb of the data was actually released t= o the
> OS.

sure that no other backend was/is actually still a file-handle
referenced? That open filehandle will prevent the OS from showing up the freed space on the filesystem and can happen if you have backends still
running that once referenced the table now truncated and have not done
any work since you did the truncate (like a large connection pool or
idle client connections, maybe an open psql session or something like that)= .

If that were the case, I don't think pg_databa= se_size would still be counting the size, as it would no longer be able to fi= nd it the files in that directory.

=
I think the next step would be to get an 'ls -l' listing of the $P= GDATA/base/<dboid> directory.

=
Cheers,

Jeff


CONFIDENTIALITY NOTICE: The informati= on contained in this electronic transmission may be confidential. If you ar= e not an intended recipient, be aware that any disclosure, copying, distrib= ution or use of the information contained in this transmission is prohibite= d and may be unlawful. If you have received this transmission in error, ple= ase notify us by email reply and then erase it from your computer system. --Apple-Mail=_51DAFEDD-087B-491A-8652-8B97E81D4659--