Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TEFoH-0007h5-Rt for pgsql-bugs@postgresql.org; Wed, 19 Sep 2012 08:39:06 +0000 Received: from moutng.kundenserver.de ([212.227.17.9]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TEFoF-00042s-5M for pgsql-bugs@postgresql.org; Wed, 19 Sep 2012 08:39:05 +0000 Received: from awork2.localnet (p5DDC722D.dip.t-dialin.net [93.220.114.45]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MYtjH-1T1SBL05Dv-00VHGe; Wed, 19 Sep 2012 10:39:00 +0200 From: Andres Freund Organization: 2ndquadrant.com To: pgsql-bugs@postgresql.org Subject: Re: BUG #7546: Backups on hot standby cancelled despite hot_standby_feedback=on Date: Wed, 19 Sep 2012 10:38:58 +0200 User-Agent: KMail/1.13.7 (Linux/3.6.0-rc6-andres-00066-g2682cc4-dirty; KDE/4.8.4; x86_64; ; ) Cc: Stuart Bishop , Fujii Masao References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201209191038.59068.andres@2ndquadrant.com> X-Provags-ID: V02:K0:M6Vx4be+6kgDJ+XH9KFiNTqVCqj/Goh0ASPjvNWX/wu JGVjEsSFsYBi1Pov3PTxDeurvhH9WZFxg4Oozg9NOpXx41kG1a 8101WHS9XHMTLR+C/wySFb5wpsAB+ny495OVmxcIiPPn9vhFTM IF22pKzQgosXKHpgdA1pzU3J78d0Oq+ERGPk38x0gNMruJEa/v yEXgSE4xHQ4rxKfqBrIw/mss6f9XywMfChO02TvooMX3iRD6Wl wMC7EFEcaHbutXREAY2Yaf5Rk11Ruaui6g84Vt76p541MknRtH 7rf6Bv0fkxdKuhDR9zlvlARsQBz2aOK0VQXyKkw1YGKKZh4Ncj ra01weqE3j1yIfp+h/abC4UxxGwq3/rJNiUAnj58WPNBucLExZ xF8ufqaASObCA== X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201209/208 X-Sequence-Number: 34202 On Wednesday, September 19, 2012 10:06:03 AM Stuart Bishop wrote: > On Wed, Sep 19, 2012 at 5:45 AM, Fujii Masao wrote: > > On Mon, Sep 17, 2012 at 7:28 PM, wrote: > >> The following bug has been logged on the website: > >> > >> Bug reference: 7546 > >> Logged by: Stuart Bishop > >> Email address: stuart@stuartbishop.net > >> PostgreSQL version: 9.1.5 > >> Operating system: Ubuntu 12.10 > >> Description: > >> > >> I have a primary and a hot standby using streaming replication. The hot > >> standby specifies 'hot_standby_feedback=on' with other replication > >> settings set to default. > >> > >> If a vacuum occurs on the primary while pg_dump is dumping a large > >> table, the pg_dump is cancelled, usually with the following error: > >> > >> ERROR: canceling statement due to conflict with recovery > >> DETAIL: User was holding shared buffer pin for too long. > > > > Maybe I'm missing something, but ISTM that hot_standby_feedback doesn't > > eliminate the query cancels caused by buffer pin lock which you > > encountered. It eliminates only the query cancels caused by cleanup of > > rows. So you might need to set max_standby_streaming_delay to -1, to > > avoid query cancels. I think the above is just a case of the backend waiting a long time to send data out due to your rate limiting. Why it does that holding a buffer pin may be worth investigating... > I have also seen the following (but only on production, not with my test > case): > > ERROR: canceling statement due to conflict with recovery > DETAIL: User was holding a relation lock for too long. > > If you are correct, it seems impossible with 9.1 to have reliable long > transactions on a hot standby without allowing the hot standby to lag > behind by the length of the longest transaction. Uh. I don't think thats a valid chain of thought, especially when it comes due to conflicts on relation locks. Those primarily (only?) happen if you do perform an action on the primary that requires an exlusive lock. Like ALTER TABLE, TRUNCATE, CLUSTER, LOCK TABLE, ... There is not really much the standby can do if gets a request for an exlusive lock other than either cancelling everything that blocks acquiring such a lock or waiting. Is it possible that you perform such commands on tables used on the standby? > I was hoping when the docs state "this parameter can be used to > eliminate query cancels caused by cleanup records" that it would cover > all the background maintenance. Relation lock conflicts shouldn't be caused by background maintenance. Greetings, Andres -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services