Re: WalSndWakeup() and synchronous_commit=off

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: WalSndWakeup() and synchronous_commit=off
Date: 2012-06-06 19:11:02
Message-ID: 201206062111.03021.andres@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tuesday, May 29, 2012 08:42:43 PM Andres Freund wrote:
> Hi,
>
> On Monday, May 28, 2012 07:11:53 PM Tom Lane wrote:
> > Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> > > Does anybody have a better idea than to either call WalSndWakeup() at
> > > essentially the wrong places or calling it inside a critical section?
> > >
> > > Tom, what danger do you see from calling it in a critical section?
> >
> > My concern was basically that it might throw an error. Looking at the
> > current implementation of SetLatch, it seems that's not possible, but
> > I wonder whether we want to lock ourselves into that assumption.
>
> The assumption is already made at several other places I think.
> XLogSetAsyncXactLSN does a SetLatch and is called from critical sections;
> several signal handlers call it without any attention to the context.
>
> Requiring it to be called outside would make its usage considerably less
> convenient and I don't really see what could change that would require to
> throw non-panic errors.
>
> > Still, if the alternatives are worse, maybe that's the best answer.
> > If we do that, though, let's add comments to WalSndWakeup and SetLatch
> > mentioning that they mustn't throw error.
>
> Patch attached.
I would like to invite some more review (+commit...) here ;). Imo this is an
annoying bug which should be fixed before next point release or beta/rc comes
out...

Andres
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-06-06 19:46:57 Re: Avoiding adjacent checkpoint records
Previous Message Tom Lane 2012-06-06 19:08:45 Avoiding adjacent checkpoint records