Re: Missing CFI in iterate_word_similarity()

Поиск
Список
Период
Сортировка
От Daniel Gustafsson
Тема Re: Missing CFI in iterate_word_similarity()
Дата
Msg-id 9732D8A2-EABD-4F5B-8BA0-A97DA4AB51A7@yesql.se
обсуждение исходный текст
Ответ на Missing CFI in iterate_word_similarity()  (Robins Tharakan <tharakan@gmail.com>)
Ответы Re: Missing CFI in iterate_word_similarity()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> On 2 Aug 2022, at 04:41, Robins Tharakan <tharakan@gmail.com> wrote:

> For long strings, iterate_word_similarity() can run into long-running
> tight-loops without honouring interrupts or statement_timeouts.

> Adding CHECK_FOR_INTERRUPTS() ensures that such queries respond to
> statement_timeout & Ctrl-C signals. With the patch applied, the
> above query will interrupt more quickly:

Makes sense.  While this might be a bit of a theoretical issue given the
lengths required, the fix is still sane and any such query should honor
statement timeouts (especially in a trusted extension).

> Please find the patch attached. The patch does not show any performance
> regressions when run against the above use-case.

I wasn't able to find one either.

+       CHECK_FOR_INTERRUPTS();
+
        /* Get index of next trigram */
        int         trgindex = trg2indexes[i];

Placing code before declarations will generate a compiler warning, so the check
must go after trgindex is declared.  I've fixed that in the attached to get the
cfbot green.  Marking this ready for committer in the meantime.

Looking at this I also noticed that commit be8a7a68662 changed the check_only
param to instead use a flag value but didn't update all comments.  0002 fixes
that while in there.

--
Daniel Gustafsson        https://vmware.com/


Вложения

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

Предыдущее
От: Richard Guo
Дата:
Сообщение: Re: make additional use of optimized linear search routines
Следующее
От: Ranier Vilela
Дата:
Сообщение: Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)