pgsql: Remove code in charge of freeing regexps generation by Lab.c

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема pgsql: Remove code in charge of freeing regexps generation by Lab.c
Дата
Msg-id E1pn5QS-002vsQ-2T@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Remove code in charge of freeing regexps generation by Lab.c

bea3d7e has redesigned the regexp engine so as all the allocations go
through palloc() with a dedicated memory context.  hba.c had to cope
with the past memory management logic by going through all the HBA and
ident lines generated, then directly free all the regexps found in
AuthTokens to ensure that no leaks would happen.  Such leaks could
happen for example in the postmaster after a SIGHUP, in the event of
an HBA and/or ident reload failure where all the new content parsed must
be discarded, including all the regexps that may have been compiled.

Now that regexps are palloc()'d in their own memory context,
MemoryContextDelete() is enough to ensure that all the compiled regexps
are properly gone.  Simplifying this logic in hba.c has the effect to
only remove code.  Most of it is new in v16, except the part for regexps
compiled in ident entries for the system username, so doing this cleanup
now rather than when v17 opens for business will reduce future diffs
with the upcoming REL_16_STABLE.

Some comments were incorrect since bea3d7e, now fixed to reflect the
reality.

Reviewed-by: Bertrand Drouvot, Álvaro Herrera
Discussion: https://postgr.es/m/ZDdJ289Ky2qEj4h+@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a28269708844246fb1ec00a536b391cac0a64972

Modified Files
--------------
src/backend/libpq/hba.c | 72 ++++---------------------------------------------
1 file changed, 5 insertions(+), 67 deletions(-)


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

Предыдущее
От: David Rowley
Дата:
Сообщение: pgsql: Remove old GUC name mapping for "force_parallel_mode"
Следующее
От: Thomas Munro
Дата:
Сообщение: pgsql: Fix PHJ match bit initialization.