Re: BUG #14830: Missed NOTIFications, PostgreSQL 9.1.24

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Marko Tiikkaja <marko(at)joh(dot)to>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14830: Missed NOTIFications, PostgreSQL 9.1.24
Date: 2017-10-11 17:00:18
Message-ID: 9369.1507741218@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I wrote:
> It occurred to me that it's easy to measure the worst case, ie always
> one message per notify interrupt:
>
> $ cat bnch.txt
> LISTEN foo\; NOTIFY foo;
> $ pgbench -n -c 1 -T 10 -f bnch.txt
>
> On this case it seems that the patch is circa 2% slower than HEAD,
> though that's only barely above the noise level in my measurements.

On looking at the patch again, I realized that it's not really necessary
to check TransactionIdIsCurrentTransactionId in the per-message loop.
Although it is possible to run the message-scanning code in a transaction
that's executed NOTIFY (if it also executed the session's first LISTEN),
at that point we will not yet have pushed the transaction's messages
into the queue. Therefore there is no case where the loop can see
messages queued by its own transaction.

Although TransactionIdIsCurrentTransactionId isn't really all that
expensive, removing it brings the above test case to a statistical
tie: median of 3 60-second runs is 26054 tps in HEAD or 26034 tps
with patch. (The cross-run variation is a couple hundred tps.)

So I'm now satisfied with the attached form of the patch, and
will proceed to make back-ported versions.

regards, tom lane

Attachment Content-Type Size
fix-notify-xact-testing-2.patch text/x-diff 7.4 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2017-10-11 19:51:32 Re: Combination of ordered-set aggregate function terminates JDBC connection on PostgreSQL 9.6.5
Previous Message Tom Lane 2017-10-11 15:03:01 Re: Combination of ordered-set aggregate function terminates JDBC connection on PostgreSQL 9.6.5