Re: An example of bugs for Hot Standby - Mailing list pgsql-hackers

From Andres Freund
Subject Re: An example of bugs for Hot Standby
Date
Msg-id 201001201049.59084.andres@anarazel.de
Whole thread Raw
In response to Re: An example of bugs for Hot Standby  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
On Wednesday 20 January 2010 10:40:10 Simon Riggs wrote:
> On Wed, 2010-01-20 at 06:14 +0100, Andres Freund wrote:
> > > Full resolution patch attached for Startup process waits on buffer
> > > pins.
> > > 
> > > Startup process sets SIGALRM when waiting on a buffer pin. If woken by
> > > alarm we send SIGUSR1 to all backends requesting that they check to see
> > > if they are blocking Startup process. If so, they throw ERROR/FATAL as
> > > for other conflict resolutions. Deadlock stop gap removed.
> > > max_standby_delay = -1 option removed to prevent deadlock.
> > 
> > Wouldnt it be more foolproof to also loop around sending the FATAL? Not
> > that its likely but...
> 
> More foolproof and much less accurate. The Startup process doesn't know
> who is holding the buffer pin that blocks it, so it could not target a
> FATAL.
> 
> > From HoldingBufferPinThatDelaysRecovery youre calling
> > GetStartupBufferPinWaitBufId - that sounds a bit dangerous because that
> > one is acquiring a spinlock which can also get taken at other places.
> > Its not the most likely scenario, but it would certainly be annoying to
> > debug.
> Spinlock. It isn't held for long in any situation. What problem do you
> foresee?
If any backend is signalled while currently holding the ProcStructLock there 
is a basically unrecoverable deadlock - its not likely but possible.

> > Is there any supported platform with sizeof(sig_atomic_t) <4 - I would
> > doubt so? If not the locking in GetStartupBufferPinWaitBufId and
> > SetStartupBufferPinWaitBufId shouldnt be needed?
> I prefer spinlocking.
Well, its deadlock land taking the same lock inside and outside of a signal 
handler...

Andres


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: An example of bugs for Hot Standby
Next
From: Simon Riggs
Date:
Subject: Re: An example of bugs for Hot Standby