postgresql/src/backend/tsearch
Tom Lane e64cdab003 Invent qsort_interruptible().
Justin Pryzby reported that some scenarios could cause gathering
of extended statistics to spend many seconds in an un-cancelable
qsort() operation.  To fix, invent qsort_interruptible(), which is
just like qsort_arg() except that it will also do CHECK_FOR_INTERRUPTS
every so often.  This bloats the backend by a couple of kB, which
seems like a good investment.  (We considered just enabling
CHECK_FOR_INTERRUPTS in the existing qsort and qsort_arg functions,
but there are some callers for which that'd demonstrably be unsafe.
Opt-in seems like a better way.)

For now, just apply qsort_interruptible() in statistics collection.
There's probably more places where it could be useful, but we can
always change other call sites as we find problems.

Back-patch to v14.  Before that we didn't have extended stats on
expressions, so that the problem was less severe.  Also, this patch
depends on the sort_template infrastructure introduced in v14.

Tom Lane and Justin Pryzby

Discussion: https://postgr.es/m/20220509000108.GQ28830@telsasoft.com
2022-07-12 16:30:36 -04:00
..
dicts Update copyright for 2019 2019-01-02 12:44:25 -05:00
Makefile Update copyright for 2022 2022-01-07 19:04:57 -05:00
dict.c Add construct_array_builtin, deconstruct_array_builtin 2022-07-01 11:23:15 +02:00
dict_ispell.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
dict_simple.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
dict_synonym.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
dict_thesaurus.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
regis.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
spell.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
to_tsany.c Remove extraneous blank lines before block-closing braces 2022-04-13 19:16:02 +02:00
ts_locale.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
ts_parse.c Remove extraneous blank lines before block-closing braces 2022-04-13 19:16:02 +02:00
ts_selfuncs.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
ts_typanalyze.c Invent qsort_interruptible(). 2022-07-12 16:30:36 -04:00
ts_utils.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
wparser.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
wparser_def.c Update copyright for 2022 2022-01-07 19:04:57 -05:00