Re: shared-memory based stats collector
| От | Alvaro Herrera |
|---|---|
| Тема | Re: shared-memory based stats collector |
| Дата | |
| Msg-id | 20200327153402.GA1045@alvherre.pgsql обсуждение исходный текст |
| Ответ на | Re: shared-memory based stats collector (Kyotaro Horiguchi <horikyota.ntt@gmail.com>) |
| Ответы |
Re: shared-memory based stats collector
|
| Список | pgsql-hackers |
On 2020-Mar-27, Kyotaro Horiguchi wrote:
> +/*
> + * XLogArchiveWakeupEnd - Set up archiver wakeup stuff
> + */
> +void
> +XLogArchiveWakeupStart(void)
> +{
> + Latch *old_latch PG_USED_FOR_ASSERTS_ONLY;
> +
> + SpinLockAcquire(&XLogCtl->info_lck);
> + old_latch = XLogCtl->archiverWakeupLatch;
> + XLogCtl->archiverWakeupLatch = MyLatch;
> + SpinLockRelease(&XLogCtl->info_lck);
> + Assert (old_latch == NULL);
> +}
Comment is wrong about the function name; OTOH I don't think the
old_latch assigment in the fourth line won't work well in non-assert
builds. But why do you need those shenanigans? Surely
"Assert(XLogCtl->archiverWakeupLatch == NULL)" in the locked region
before assigning MyLatch should be sufficient and acceptable?
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
В списке pgsql-hackers по дате отправления: