Re: Terminating a backend

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Terminating a backend
Date: 2008-03-10 18:17:49
Message-ID: 20080310181749.GE8199@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > 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.
>
> > Should I add this as a TODO? Seems so. Tom commented in the patches
> > queue that it will not work but I don't understand why.
>
> The problem with treating it like elog(ERROR) is that you're at the
> mercy of user-defined code as to whether you'll actually exit or not.
> UDFs can trap elog(ERROR).

Well, we can punt and blame the writer of the UDF if the signal is not
timely honored. Having something that works for 98% of the cases, can
be fixed for 1% of the remainder, and only fails in 1% (proprietary code
that cannot be fixed) is better than having nothing at all.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2008-03-10 18:22:20 Re: Terminating a backend
Previous Message Tom Lane 2008-03-10 17:57:45 Re: Terminating a backend

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2008-03-10 18:22:20 Re: Terminating a backend
Previous Message Tom Lane 2008-03-10 17:57:45 Re: Terminating a backend