pgsql: Fix race conditions when an event trigger is addedconcurrently

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix race conditions when an event trigger is addedconcurrently
Дата
Msg-id E1f9dNh-00013d-4C@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix race conditions when an event trigger is added concurrently with DDL.

EventTriggerTableRewrite crashed if there were table_rewrite triggers
present, but there had not been when the calling command started.

EventTriggerDDLCommandEnd called ddl_command_end triggers if present,
even if there had been no such triggers when the calling command started,
which would lead to a failure in pg_event_trigger_ddl_commands.

In both cases, fix by doing nothing; it's better to wait till the next
command when things will be properly initialized.

In passing, remove an elog(DEBUG1) call that might have seemed interesting
four years ago but surely isn't today.

We found this because of intermittent failures in the buildfarm.  Thanks
to Alvaro Herrera and Andrew Gierth for analysis.

Back-patch to 9.5; some of this code exists before that, but the specific
hazards we need to guard against don't.

Discussion: https://postgr.es/m/5767.1523995174@sss.pgh.pa.us

Branch
------
REL_10_STABLE

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

Modified Files
--------------
src/backend/commands/event_trigger.c | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Tweak a couple of planner APIs to save recalculating joinrelids
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Don't run fast_default regression test in parallel with otherte