Add assertion on held AddinShmemInitLock in GetNamedLWLockTranche()

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Add assertion on held AddinShmemInitLock in GetNamedLWLockTranche()
Дата
Msg-id ZMM07Bw8ZvSQ4hJp@paquier.xyz
обсуждение исходный текст
Ответы Re: Add assertion on held AddinShmemInitLock in GetNamedLWLockTranche()  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Список pgsql-hackers
Hi all,

While digging into the LWLock code, I have noticed that
GetNamedLWLockTranche() assumes that its caller should hold the LWLock
AddinShmemInitLock to prevent any kind of race conditions when
initializing shmem areas, but we don't make sure that's the case.

The sole caller of GetNamedLWLockTranche() in core respects that, but
out-of-core code may not be that careful.  How about adding an
assertion based on LWLockHeldByMeInMode() to make sure that the
ShmemInit lock is taken when this routine is called, like in the
attached?

Thanks,
--
Michael

Вложения

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Support worker_spi to execute the function dynamically.
Следующее
От: Alexander Lakhin
Дата:
Сообщение: Re: Postgres v15 windows bincheck regression test failures