pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@2ndquadrant.com>
To: Stuart Bishop <stuart@stuartbishop.net>
Cc: pgsql-bugs@postgresql.org
Cc: Fujii Masao <masao.fujii@gmail.com>
Subject: Re: BUG #7546: Backups on hot standby cancelled despite hot_standby_feedback=on
Date: Wed, 19 Sep 2012 13:56:11 +0200
Message-ID: <201209191356.12176.andres@2ndquadrant.com> (raw)
In-Reply-To: <CADmi=6PNxhsvC8DLVjUY2CpsGWDocJkurDHMW3mjf_p0VnTreg@mail.gmail.com>
References: <CADmi=6Mj2q3kaL3qph9rEc9z7Z8Sm+efjOZu-yMa4u75ACVrmA@mail.gmail.com>
	<201209191038.59068.andres@2ndquadrant.com>
	<CADmi=6PNxhsvC8DLVjUY2CpsGWDocJkurDHMW3mjf_p0VnTreg@mail.gmail.com>

On Wednesday, September 19, 2012 11:33:29 AM Stuart Bishop wrote:
> On Wed, Sep 19, 2012 at 3:38 PM, Andres Freund <andres@2ndquadrant.com> 
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




view thread (8+ messages)  latest in thread

Message-ID: <201209191356.12176.andres@2ndquadrant.com>
Permalink:  ../201209191356.12176.andres@2ndquadrant.com/
Also on:    postgresql.org/message-id/201209191356.12176.andres@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andres@2ndquadrant.com, stuart@stuartbishop.net, masao.fujii@gmail.com
  Subject: Re: BUG #7546: Backups on hot standby cancelled despite hot_standby_feedback=on
  In-Reply-To: <201209191356.12176.andres@2ndquadrant.com>
  References: <CADmi=6Mj2q3kaL3qph9rEc9z7Z8Sm+efjOZu-yMa4u75ACVrmA@mail.gmail.com> <201209191038.59068.andres@2ndquadrant.com> <CADmi=6PNxhsvC8DLVjUY2CpsGWDocJkurDHMW3mjf_p0VnTreg@mail.gmail.com> <201209191356.12176.andres@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox