Skip site navigation (1) Skip section navigation (2)

Re: Hot Standby and deadlock detection

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Greg Stark <gsstark(at)mit(dot)edu>
Subject: Re: Hot Standby and deadlock detection
Date: 2010-02-01 10:13:00
Message-ID: 1265019180.13782.11250.camel@ebony (view raw or flat)
Thread:
Lists: pgsql-hackers
On Mon, 2010-02-01 at 09:40 +0200, Heikki Linnakangas wrote:
> Simon Riggs wrote:
> > The way this would work is if Startup waits on a buffer pin we
> > immediately send out a request to all backends to cancel themselves if
> > they are holding the buffer pin required && waiting on a lock. We then
> > sleep until max_standby_delay. When max_standby_delay = -1 we only sleep
> > until deadlock timeout and then check (on the Startup process).
> 
> Should wake up to check for deadlocks after deadlock_timeout also when
> max_standby_delay > deadlock_timeout. max_standby_delay could be hours -
> we want to detect a deadlock sooner than that.

The patch does detect deadlocks sooner that that - "immediately", as
described above.

The simplified logic is

if (MaxStandbyDelay == 0)
	immediate time out any buffer pin holders
else if (MaxStandbyDelay == -1)
	wait for deadlock_timeout then check for deadlockers
else if (standby_delay > MaxStandbyDelay)
	immediate time out on buffer pin
else
{
	immediate(*) check for deadlockers
	wait for remainder of time then time out any buffer pin holders
}

(*) Doing it this way makes the logic sigalarm handler code easier/more
bug free. The only difference is a potential performance gain from not
running deadlock detection early.

-- 
 Simon Riggs           www.2ndQuadrant.com


In response to

Responses

pgsql-hackers by date

Next:From: Simon RiggsDate: 2010-02-01 10:14:56
Subject: Re: [COMMITTERS] pgsql: Write a WAL record whenever we perform an operation without
Previous:From: Heikki LinnakangasDate: 2010-02-01 10:11:56
Subject: Re: [COMMITTERS] pgsql: Write a WAL record whenever we perform an operation without

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group