Re: Considering signal handling in plpython again - Mailing list pgsql-hackers

From Hubert Zhang
Subject Re: Considering signal handling in plpython again
Date
Msg-id CAB0yrenas-CW8Nif9Zu+w4tv9oAZ3_unKL_Ye6JVJcqs0gtYQg@mail.gmail.com
Whole thread Raw
In response to Re: Considering signal handling in plpython again  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: Considering signal handling in plpython again  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-hackers
There are remaining two problems

1. Do we need to consider when to delete the extension hook or it's not necessary?
    As the destroy function _PG_fini doesn't work, I cannot find a good place to reset to hook gracefully.
    I tested the drop language plpythonu statement which will not remove the python shared library in the current session,
    So it seems to be safe to leave the cancel_handler_hook not be reset.
    How about other extensions, for example plr. Does the "drop extension" statement will not remove the loaded shared library in the process either?
    
    -- Another idea is to register the hook at the beginning of plpython_call_handler and unregister the hook at the end of plpython_call_handler.

2. Do we need to use explicit hook list(List *cancel_hook_list) instead of implicit cancel_hook(which relies on the extension to link the cancel_hook inside their code 
     e.g. prev_hook = cancel_hook; cancel_hook=my_hook;   void my_hook(){mywork(); (*prev_hook)();} )?
    I didn't find any explicit hook list in PG code base, is that a good practice?

-- Hubert


On Mon, May 14, 2018 at 6:40 PM, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
On 14/05/18 10:56, Hubert Zhang wrote:
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.

Yeah, that seems reasonable.

- Heikki



--
Thanks

Hubert Zhang

pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: Expression errors with "FOR UPDATE" and postgres_fdw withpartition wise join enabled.
Next
From: Tom Lane
Date:
Subject: Re: [BUGFIX] amcanbackward is not checked before building backward index paths