Re: pg_sleep() doesn't work well with recovery conflict interrupts.

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: pg_sleep() doesn't work well with recovery conflict interrupts.
Date: 2014-06-02 03:11:40
Message-ID: CAA4eK1+Y9ghvZPgN=sgDuhyvMb+j61zkAmpnMi30EFA9ckY4aA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jun 1, 2014 at 1:05 PM, Andres Freund <andres(at)2ndquadrant(dot)com>
wrote:
> On 2014-05-30 10:30:42 +0530, Amit Kapila wrote:
> > On Wed, May 28, 2014 at 8:53 PM, Andres Freund <andres(at)2ndquadrant(dot)com>
> > > Since a64ca63e59c11d8fe6db24eee3d82b61db7c2c83 pg_sleep() uses
> > > WaitLatch() to wait. That's fine in itself. But
> > > procsignal_sigusr1_handler, which is used e.g. when resolving recovery
> > > conflicts, doesn't unconditionally do a SetLatch().
> > > That means that we'll we'll currently not be able to cancel
conflicting
> > > backends during recovery for 10min. Now, I don't think that'll happen
> > > too often in practice, but it's still annoying.
> >
> > How will such a situation occur, aren't we using pg_usleep during
> > RecoveryConflict functions
> > (ex. in ResolveRecoveryConflictWithVirtualXIDs)?
>
> I am not sure what you mean. pg_sleep() is the SQL callable function, a
> different thing to pg_usleep().

I was not clear how such a situation can occur, but now looking at
it bit more carefully, I think I understood that any backend calling
pg_sleep() during recovery conflict resolution can face this situation.

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2014-06-02 11:03:42 Re: Allowing join removals for more join types
Previous Message Andrew Dunstan 2014-06-01 23:13:47 Re: jsonb access operators inefficiency