Re: Hot Standby WAL reply uses heavyweight session locks, but doesn't have enough infrastructure set up - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Hot Standby WAL reply uses heavyweight session locks, but doesn't have enough infrastructure set up
Date
Msg-id 20150130203429.GA13118@alap3.anarazel.de
Whole thread Raw
In response to Re: Hot Standby WAL reply uses heavyweight session locks, but doesn't have enough infrastructure set up  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Hot Standby WAL reply uses heavyweight session locks, but doesn't have enough infrastructure set up
List pgsql-hackers
On 2015-01-29 11:01:51 -0500, Robert Haas wrote:
> On Wed, Jan 28, 2015 at 2:41 AM, Michael Paquier
> <michael.paquier@gmail.com> wrote:
> > Andres Freund wrote:
> >> I think this isn't particularly pretty, but it seems to be working well
> >> enough, and changing it would be pretty invasive. So keeping in line
> >> with all that code seems to be easier.
> > OK, I'm convinced with this part to remove the call of
> > LockSharedObjectForSession that uses dontWait and replace it by a loop
> > in ResolveRecoveryConflictWithDatabase.
>
> That seems right to me, too.

It's slightly more complicated than that. The lock conflict should
actually be resolved using ResolveRecoveryConflictWithLock()... That,
combined with the race of connecting a actually already deleted database
(see the XXXs I removed) seem to make the approach in here.

Attached are two patches:
1) Infrastructure for attaching more kinds of locks on the startup
   process.
2) Use that infrastructure for database locks during replay.

I'm not sure 2) alone would be sufficient justification for 1), but the
nearby thread about basebackups also require similar infrastructure...

Greetings,

Andres Freund

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

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Proposal: knowing detail of config files via SQL
Next
From: Andres Freund
Date:
Subject: Re: basebackups during ALTER DATABASE ... SET TABLESPACE ... not safe?