Re: Listen / Notify - what to do when the queue is full

Поиск
Список
Период
Сортировка
От Joachim Wieland
Тема Re: Listen / Notify - what to do when the queue is full
Дата
Msg-id dc7b844e0911181706h62129748m6e519bf7c686611e@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Listen / Notify - what to do when the queue is full  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Listen / Notify - what to do when the queue is full
Список pgsql-hackers
On Thu, Nov 19, 2009 at 1:48 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Joachim Wieland <joe@mcknight.de> writes:
>> 4) Allow readers to read uncommitted notifications as well.
>
> The question that strikes me here is one of timing --- apparently,
> readers will now have to check the queue *without* having received
> a signal?  That could amount to an unpleasant amount of extra overhead
> when the notify system isn't even in use.  (Users who don't care about
> notify will define "unpleasant amount" as "not zero".)

The sequence in CommitTransaction() is like that:

1) add notifications to queue
2) commit to clog
3) signal backends

Only those backends are signalled that listen to at least one channel,
if the notify system isn't in use, then nobody will ever be signalled
anyway.

If a backend is reading a transaction id that has not yet committed,
it will not deliver the notification. It knows that eventually it will
receive a signal from that transaction and then it first checks its
list of uncommitted notifications it has already read and then checks
the queue for more pending notifications.


Joachim


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

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Listen / Notify - what to do when the queue is full
Следующее
От: KaiGai Kohei
Дата:
Сообщение: Re: TRIGGER with WHEN clause