Re: [HACKERS] libpqrcv_PQexec() seems to violate latch protocol

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: [HACKERS] libpqrcv_PQexec() seems to violate latch protocol
Дата
Msg-id 20170606214237.xgcyfw64tik3sd75@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: [HACKERS] libpqrcv_PQexec() seems to violate latch protocol  (Petr Jelinek <petr.jelinek@2ndquadrant.com>)
Ответы Re: [HACKERS] libpqrcv_PQexec() seems to violate latch protocol  (Petr Jelinek <petr.jelinek@2ndquadrant.com>)
Список pgsql-hackers
On 2017-06-06 23:24:50 +0200, Petr Jelinek wrote:
> On 06/06/17 23:17, Andres Freund wrote:
> > Right.  I found a couple more instance of similarly iffy, although not
> > quite as broken, patterns in launcher.c.  It's easy to get this wrong,
> > but it's a lot easy if you do it differently everywhere you use a
> > latch.  It's not good if code in the same file, by the same author(s),
> > has different ways of using latches.
> 
> Huh? I see same pattern everywhere in launcher.c, what am I missing?

WaitForReplicationWorkerAttach:
while (...)   CHECK_FOR_INTERRUPTS();   /* other stuff including returns */   WaitLatch()   WL_POSTMASTER_DEATH
ResetLatch()

logicalrep_worker_stop loop 1:
while (...)   /* other stuff */   CHECK_FOR_INTERRUPTS()   WaitLatch()   POSTMASTER_DEATH   ResetLatch()   /* other
stuffincluding returns */
 
logicalrep_worker_stop loop 1:
while (...)   /* other stuff including returns */   CHECK_FOR_INTERRUPTS();   WaitLatch()   WL_POSTMASTER_DEATH
ResetLatch()

ApplyLauncherMain:
while (!got_SIGTERM)   /* lots other stuff */   WaitLatch()   WL_POSTMASTER_DEATH   /* some other stuff */
ResetLatch()
(note no CFI)

they're not hugely different, but subtely there are differences.
Sometimes you're guaranteed to check for interrupts after resetting the
latch, in other cases not. Sometimes expensive-ish things happen before
a CFI...

Greetings,

Andres Freund



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] PG10 transition tables, wCTEs and multiple operationson the same table
Следующее
От: Mike Palmiotto
Дата:
Сообщение: Re: [HACKERS] [BUGS] BUG #14682: row level security not work with partitioned table