Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TEItC-0006sd-Qz for pgsql-bugs@postgresql.org; Wed, 19 Sep 2012 11:56:22 +0000 Received: from moutng.kundenserver.de ([212.227.126.186]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TEIt6-0003TB-CS for pgsql-bugs@postgresql.org; Wed, 19 Sep 2012 11:56:22 +0000 Received: from awork2.localnet (p5DDC7EE7.dip.t-dialin.net [93.220.126.231]) by mrelayeu.kundenserver.de (node=mreu4) with ESMTP (Nemesis) id 0MWcQg-1SzThH0yV8-00Y1yu; Wed, 19 Sep 2012 13:56:13 +0200 From: Andres Freund Organization: 2ndquadrant.com To: Stuart Bishop Subject: Re: BUG #7546: Backups on hot standby cancelled despite hot_standby_feedback=on Date: Wed, 19 Sep 2012 13:56:11 +0200 User-Agent: KMail/1.13.7 (Linux/3.6.0-rc6-andres-00066-g2682cc4-dirty; KDE/4.8.4; x86_64; ; ) Cc: pgsql-bugs@postgresql.org, Fujii Masao References: <201209191038.59068.andres@2ndquadrant.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201209191356.12176.andres@2ndquadrant.com> X-Provags-ID: V02:K0:SsIZIjOrph+WbvG1GXU7bpcQJHUo1/xi4gvyLKzm3Q1 BXzdAi64XdtoGLym3lswsR0cCJL30eWC0m8YBShXDC5Mr2VMuG vG7hw/pkr3SVI1x2kk1RFN0R69kSzteh/Jkwlc0v2gW83TDm4X 9HUntHo61/I1+OhQJ4xVuXkeNj3hzMMextJuEIlaDMx1Te3SSA OtS+XJoS6jjpvFgJpV3XNNcp6LvLQQwGTVo3id/evgmgnwgsi6 sILUXOG0lkPD6iAQGDmSYhJtJzIgNXdKrTY96FPtg5+/YugYpm Pp0tdTsK6iG7zs0UnoW5gaezLNK5ZgLDiTa/+4w8MSDlNB1mzv Ao0N+081Smajn2GZWiEFAznimcIeI/Smi1RQ3tsir X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201209/210 X-Sequence-Number: 34204 On Wednesday, September 19, 2012 11:33:29 AM Stuart Bishop wrote: > On Wed, Sep 19, 2012 at 3:38 PM, Andres Freund wrote: > >> >> 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 put the rate limiting in there to trigger the problem consistently > with a small data set. On the main production server I see this > problem, it normally fails dumping a table with nearly 2 billion rows > to local disk (pg_dump -Fc). The trick seems to be that vacuum needs > to start running on the primary after the dump starts on the hot > standby, and the vacuum complete before the dump finishes. You see buffer pin errors or you see the relation errors? Those arent the same. So if you see no buffer pin errors but relation lock ones in production your way to reproduce the issue isn't telling us very much ;) > >> 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. > > > > Is it possible that you perform such commands on tables used on the > > standby? > > Yes, it is quite possible CREATE INDEX CONCURRENTLY was run on the > primary during the backup window. I can't discount other commands > either, but if that is the case one of our ops needs a spanking. I've > only been able to reproduce the buffer pin error in isolation. Do you have DDL logging enabled so you could investigate that? I really wonder why we don't bother logging the dbOid/relOid pair before we cancel transactions due to lock conflicts. That should make investigating such issues considerably easier... Greetings, Andres -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services