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

Re: [HACKERS] Terminating a backend

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] Terminating a backend
Date: 2008-04-12 15:32:00
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
Bruce Momjian wrote:
> Bruce Momjian wrote:
> > I have an idea for this TODO item:
> > 
> > 	* Allow administrators to safely terminate individual sessions either
> > 	  via an SQL function or SIGTERM
> > 	
> > 	  Lock table corruption following SIGTERM of an individual backend
> > 	  has been reported in 8.0.  A possible cause was fixed in 8.1, but
> > 	  it is unknown whether other problems exist.  This item mostly
> > 	  requires additional testing rather than of writing any new code.
> > 	
> >
> > 
> > When we get the termination signal, why can't we just set a global
> > boolean, do a query cancel, and in the setjmp() code block check the
> > global and exit --- at that stage we know we have released all locks and
> > can exit cleanly.
> I have implemented this idea with the attached patch.

One problem I have with my patch is that SIGTERM is currently used by
the postmaster to shut down backends.  Now because the postmaster knows
that all backend are terminating, it can accept a dirtier shutdown than
one where we are terminating just one backend and the rest are going to
keep running.  The new SIGTERM coding is going to exit a backend only in
a place where cancel is checked.

I need some thoughts in this area.

  Bruce Momjian  <bruce(at)momjian(dot)us>

  + If your life is a hard drive, Christ can be your backup. +

In response to


pgsql-hackers by date

Next:From: Tom LaneDate: 2008-04-12 16:00:38
Subject: Re: runtime error on SPGIST, needed help
Previous:From: Simone CamporaDate: 2008-04-12 15:18:22
Subject: runtime error on SPGIST, needed help

pgsql-patches by date

Next:From: Tom LaneDate: 2008-04-12 15:52:00
Subject: Re: libpq patch for pqtypes hook api and PGresult creation
Previous:From: Bruce MomjianDate: 2008-04-12 14:04:09
Subject: Re: [HACKERS] Terminating a backend

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