Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 7EBB7B5DBBE for ; Mon, 22 Aug 2011 03:57:44 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 06352-06 for ; Mon, 22 Aug 2011 06:57:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og124.obsmtp.com (exprod7og124.obsmtp.com [64.18.2.26]) by mail.postgresql.org (Postfix) with ESMTP id BADEEB5D803 for ; Mon, 22 Aug 2011 03:57:36 -0300 (ADT) Received: from mail-fx0-f41.google.com ([209.85.161.41]) (using TLSv1) by exprod7ob124.postini.com ([64.18.6.12]) with SMTP ID DSNKTlH93wuV3wMxu0GK5Pky0fPyVNnFyf0Q@postini.com; Sun, 21 Aug 2011 23:57:37 PDT Received: by fxg9 with SMTP id 9so3835353fxg.0 for ; Sun, 21 Aug 2011 23:57:33 -0700 (PDT) Received: by 10.223.75.25 with SMTP id w25mr3177127faj.140.1313996253639; Sun, 21 Aug 2011 23:57:33 -0700 (PDT) Received: from [192.168.1.183] (dsl-hkibrasgw2-ff7ac300-240.dhcp.inet.fi [88.195.122.240]) by mx.google.com with ESMTPS id c7sm4868919fac.36.2011.08.21.23.57.30 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 21 Aug 2011 23:57:31 -0700 (PDT) Message-ID: <4E51FDD9.6050403@enterprisedb.com> Date: Mon, 22 Aug 2011 09:57:29 +0300 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; fi-FI; rv:1.9.2.18) Gecko/20110626 Icedove/3.1.11 MIME-Version: 1.0 To: Daniel Farina CC: pgsql-bugs@postgresql.org Subject: Re: BUG #6170: hot standby wedging on full-WAL disk References: <201108200039.p7K0dwle083531@wwwmaster.postgresql.org> In-Reply-To: <201108200039.p7K0dwle083531@wwwmaster.postgresql.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201108/127 X-Sequence-Number: 30939 On 20.08.2011 03:39, Daniel Farina wrote: > > The following bug has been logged online: > > Bug reference: 6170 > Logged by: Daniel Farina > Email address: daniel@heroku.com > PostgreSQL version: 9.0.4 > Operating system: GNU/Linux Ubuntu 10.04 x86_64 > Description: hot standby wedging on full-WAL disk > Details: > > After seeing this a few times, I think I've found a reproducible way to > prevent Postgres from making progress with hot standby. > > 1) Set up a WAL disk that will run out of space in a reasonable amount of > time. > > 2) Run a hot standby with a restore_command and primary_connection_info set > in recovery.conf. ***Configure it to disable query cancellation***. > > 3) Begin a transaction, or long-running statement that prevents the > application of WAL records. > > When the hot standby falls behind the primary it'll eventually bump out of > streaming mode, and will accumulate WAL until the disk fills. > > Eventually the WAL disk will fill, and the hot standby cannot make any > progress until one deletes some WAL segments or otherwise makes a tiny bit > more room to work with. This state persists past killing the offensive > long-running-transaction backend and even a postgres restart. In the latter > case, one cannot even become 'hot' again, getting the "database system is > starting up" message, as Postgres wants to run a restore_command > immediately. > > Furthermore, it appears that WAL segments from the future part of the > timeline (beyond what is being recovered at the moment) are stored on-disk > at that time. I also think I have identified some WAL segments that are > from before the prior checkpoint location via pg_controldata, so they > technically could be pruned. My wal_keep_segments is set, but I am not sure > if this has an effect on a hot standby. So the problem is that walreceiver merrily writes so much future WAL that it runs out of disk space? A limit on the maximum number of future WAL files to stream ahead would fix that, but I can't get very excited about it. Usually you do want to stream as much ahead as you can, to ensure that the WAL is safely on disk on the standby, in case the master dies. So the limit would need to be configurable. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com