Re: Considering signal handling in plpython again

From: Hubert Zhang <hzhang(at)pivotal(dot)io>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Robert Eckhardt <reckhardt(at)pivotal(dot)io>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Considering signal handling in plpython again
Date: 2018-05-14 07:56:08
Message-ID: CAB0yremWeycDgpZFOuoAotW0tTk1Rf=9CgvAxrVZBRnUmzRgcA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

For nested SPI case, one option is to turn off the bool variable when
entering the SPI function(PLy_spi_prepare, PLy_spi_execute, PLy_cursor etc.)
and turn on the bool variable again when exiting the SPI function.
If it's OK, we could follow this way to update Heikki's patch.

--Hubert

On Fri, May 11, 2018 at 9:28 PM, Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:

>
>
> On 11 May 2018 10:01:56 EEST, Hubert Zhang <hzhang(at)pivotal(dot)io> wrote:
> >2. Add a flag in hook function to indicate whether to call
> >Py_AddPendingCall.
> >This is straightforward.(I prefer it)
>
> Yeah, that's what I had in mind, too. A global bool variable that's set
> when you enter libpython, and cleared on return. Need to handle nesting,
> i.e if a PL/python function runs a slow query with SPI, and cancellation
> happens during that. And the case that the SPI query calls another
> PL/python function.
>
> - Heikki
>

--
Thanks

Hubert Zhang

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2018-05-14 09:45:19 Incorrect path in header comment identification
Previous Message Pavan Deolasee 2018-05-14 07:44:22 Re: PANIC during crash recovery of a recently promoted standby