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-13 18:12:10
Message-ID: 200804131812.m3DICAw21846@momjian.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
Bruce Momjian wrote:
> > > 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 have a idea --- to have pg_terminate_backend() set a PGPROC boolean
and then send a query cancel signal to the backend --- the backend can
then check the boolean and exit if required.  I will work on a new
version of this patch tomorrow/Monday.

-- 
  Bruce Momjian  <bruce(at)momjian(dot)us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

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

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2008-04-13 19:21:06
Subject: Re: Remove lossy-operator RECHECK flag?
Previous:From: Tom LaneDate: 2008-04-13 17:49:36
Subject: Re: pgwin32_safestat weirdness

pgsql-patches by date

Next:From: Gavin SherryDate: 2008-04-13 18:24:21
Subject: Re: datum passed to macro which expects a pointer
Previous:From: Andrew ChernowDate: 2008-04-13 15:50:47
Subject: Re: libpq patch for pqtypes hook api and PGresult creation

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