Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VbyhR-0005Q8-4q for pgsql-admin@arkaria.postgresql.org; Thu, 31 Oct 2013 20:18:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VbyhQ-0006Md-Jz for pgsql-admin@arkaria.postgresql.org; Thu, 31 Oct 2013 20:18:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VbyhP-0006Ku-3w for pgsql-admin@postgresql.org; Thu, 31 Oct 2013 20:18:35 +0000 Received: from qmta03.westchester.pa.mail.comcast.net ([2001:558:fe14:43:76:96:62:32]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VbyhK-0002Qh-Up for pgsql-admin@postgresql.org; Thu, 31 Oct 2013 20:18:34 +0000 Received: from omta11.westchester.pa.mail.comcast.net ([76.96.62.36]) by qmta03.westchester.pa.mail.comcast.net with comcast id jrpl1m0050mv7h053wJUnR; Thu, 31 Oct 2013 20:18:28 +0000 Received: from jerry.enova.com ([38.98.177.132]) by omta11.westchester.pa.mail.comcast.net with comcast id jwJH1m01A2rmZlA3XwJKGS; Thu, 31 Oct 2013 20:18:26 +0000 Received: by jerry.enova.com (Postfix, from userid 1001) id 5A13C7401FC; Thu, 31 Oct 2013 15:18:17 -0500 (CDT) From: Jerry Sievers To: Drazen Kacar Cc: pgsql-admin@postgresql.org Subject: Re: Zeroed out pages at the end of the database files References: Date: Thu, 31 Oct 2013 15:18:16 -0500 In-Reply-To: (Drazen Kacar's message of "Wed, 30 Oct 2013 17:35:23 +0100") Message-ID: <86k3gtnqif.fsf@jerry.enova.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1383250708; bh=o0r9TxfdExhe+70xPprr7bN7xLNj7Pz0BK84VMpaqv8=; h=Received:Received:Received:From:To:Subject:Date:Message-ID: MIME-Version:Content-Type; b=K1JcpPMMfw2vVL8e+yjabbA8TQeDPs9HOgmCS8di2HF6UFyXp2fXBkFFnOkyHsuT6 T4gWIwVI2jvgKuY6cagzTfZBb518wvz7KFI21QltWwzKcMW77ZExdzRArdr3v/0VX4 WZiIWbk0qe10QXLo7K8nTMa9nV6sJ2CYAoTG9Lf75R88jscAeFH7Uzee99OguWYKfD ZoK09leYx7LU1RBYn0cdTZeV4dUu2856uucCKP34TG3MJ6IGAZUCB1B8i7njpWO/i2 8uxXueIeOR1Ow6Edm5Fw/i7vMMpqdh5cq4W6JEKWqu5Ubd+83laWS1Z8o+TiMaJ00K yiu+Pkxu3HILQ== X-Pg-Spam-Score: -1.3 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Drazen Kacar writes: > Hello, > > I'm running PostgreSQL 9.2.4 on Ubuntu 12.04.3 LTS. It's being used by an application that has recently gone from demo (very, very low usage) to production (low, but > constant usage). It runs the autovacuum daemon and zero_damaged_pages configuration parameter is off. > > Since Postgres 9.2 doesn't have block checksums I implemented a poor man's consistency checking: on the backup server every backup is unpacked and pg_filedump > | grep Error is run on every database file. I have never seen any error reported by that, until the last Sunday the first one appeared. Are you running pg_filedump against either or both of a. live DB, b. unpacked hot-backup that hasn't been started and allowed to reach consistent recovery state? If so, then I don't presume you'll have a reliable outcome though if this had been done in the past on a system with very little throughput, it might work by luck. > It turned out that pg_filedump reported errors for 34 database files, but that was because all those files had one or more database pages (8k) at the end of the file > zeroed out. So pg_filedump couldn't find the proper header and thus reported an error. This was also the case on the main server, so it wasn't some error present on the > backup server only. Database files stay in this condition for a time (I'm not sure how long) and then the zeroed out pages disappear. Postgres doesn't report any kind > of an error. > > I want to ask if this behaviour is normal. > > I know that autovacuum can truncate the db file if it happens that the last page(s) don't contain live data, so this behaviour could be that, but it seems weird that > the pages would first be zeroed out and then, some time later, the file truncated. Why not truncate it immediately? > > My checking incantation is: > > cd $PGDATA > for f in `find base global -type f -name '[0-9]*' \! -empty`; do > ??? pg_filedump $f | grep -q Error > ??? [[ $? -eq 0 ]] && echo $f > done > > And later, to verify that all errors are zeroed-out pages at the end of the file: > > pg_filedump -d > -- Jerry Sievers Postgres DBA/Development Consulting e: postgres.consulting@comcast.net p: 312.241.7800 -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin