Re: [PATCH] Avoid pallocs in async.c's "critical section"

Поиск
Список
Период
Сортировка
От Joel Jacobson
Тема Re: [PATCH] Avoid pallocs in async.c's "critical section"
Дата
Msg-id ac0e7326-e825-4ed9-9dcd-c2bff11b160b@app.fastmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] Avoid pallocs in async.c's SignalBackends critical section  ("Joel Jacobson" <joel@compiler.org>)
Ответы Re: [PATCH] Avoid pallocs in async.c's "critical section"
Список pgsql-hackers
On Tue, Nov 25, 2025, at 11:15, Joel Jacobson wrote:
> With the following three changes, I think the only remaining
> potentially-risky code in AtCommit_Notify, is the acquire/release of
> locks.

Patch 0001 and 0002 are unchanged since v2.

0003:

Since this thread is specifically about avoiding pallocs in the
effective "critical section", I realize we shouldn't change
listenChannels from a list to hash (in this patch), but just move the
existing potentially-risky code out of AtCommit_Notify.

Thanks to a sharper focus on that, I realized Tom's alternative design
idea from [1], to just go ahead and perform the LISTEN/UNLISTEN updates
in PreCommit_Notify, is an excellent simplification, with no real
downsides that I can identify.

This allowed simplifying 0003 a lot, by just doing all LISTEN/UNLISTEN
operations during PreCommit:

    1 file changed, 100 insertions(+), 139 deletions(-)

I really hope this approach is acceptable, because then the optimization
patch will become much simpler.

Please advise whether you think this makes sense, and whether we should
keep this thread open or fold the result directly into [1].

Patches:
* 0001-async-avoid-pallocs-in-critical-section-v3.patch:
Preallocate signal arrays to avoid pallocs AtCommit
* 0002-async-avoid-pallocs-in-critical-section-v3.patch:
Move asyncQueueAdvanceTail from AtCommit to PreCommit
* 0003-async-avoid-pallocs-in-critical-section-v3.patch:
Execute LISTEN/UNLISTEN during PreCommit

/Joel

[1] https://www.postgresql.org/message-id/flat/6899c044-4a82-49be-8117-e6f669765f7e%40app.fastmail.com

Вложения

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