Heikki Linnakangas <hlinnaka@iki.fi> writes:
> Fortunately that's easy to fix: We can move the IsListeningOn() check
> after releasing the lock. See attached.
> The elephant in the room of course is that a lookup in a linked list is
> O(n) and it would be very straightforward to replace it with e.g. a hash
> table. We should do that irrespective of this bug fix. But I'm inclined
> to do it as a separate followup patch.
There is a different patch series that's concerned with improving
NOTIFY throughput [1]. I think this one should just focus on
fixing the XID problem.
regards, tom lane
[1] https://commitfest.postgresql.org/patch/6078/