Proposal for Signal Detection Refactoring

Поиск
Список
Период
Сортировка
От Chris Travers
Тема Proposal for Signal Detection Refactoring
Дата
Msg-id CAN-RpxD_MDp_wbP2Ob_6TyRdTc+4poufEXbQUnQNVBpAcdY+YQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Proposal for Signal Detection Refactoring  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
After the patch we did for the race condition here, one point which was brought up which I thought was quite relevant was the fact that checking global flags feels a little ugly.

I would like to set up a patch which refactors this as follows:

1.  We create an enum of cancellation levels:
    NO_INTERRUPT
    INTERRUPT
    QUERY_CANCEL
    PROCESS_EXIT

2.  We create a macro called PENDING_INTERRUPT_LEVEL() which returns the highest pending interrupt level.

3.  We check on whether the output of this is greater or equal to the level we need to handle and work on that basis.

This allows us to handle cases where we just want to check the interrupt level for return or cleanup purposes.  It does not apply to cases where we need to change interrupt handling temporarily as we do in a couple of cases.  I think it is cleaner than checking the QueryCancelPending and ProcDiePending global flags directly.

So here's a small patch.  I will add it for the next commit fest unless anyone has any reason I shouldn't.

--
Best Regards,
Chris Travers
Head of Database

Tel: +49 162 9037 210 | Skype: einhverfr | www.adjust.com 
Saarbrücker Straße 37a, 10405 Berlin

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: Query is over 2x slower with jit=on
Следующее
От: "Jonathan S. Katz"
Дата:
Сообщение: Re: PostgreSQL 11 {Beta 4, RC1} Release: 2018-09-20