Improve shared queue synchronization further
authorPavan Deolasee <pavan.deolasee@gmail.com>
Wed, 20 Sep 2017 10:07:56 +0000 (15:37 +0530)
committerPavan Deolasee <pavan.deolasee@gmail.com>
Wed, 20 Sep 2017 10:07:56 +0000 (15:37 +0530)
commitdcdcfad2da6921a2d66449ce12d4e2ec7cdc1d02
treed8dd98d0ee29c3c642428deb15eb6dd645372018
parent5c4314a01104452da784536d295a71c5ecaf4b78
Improve shared queue synchronization further

Our efforts to improve shared queue synchronization continues. We now have a
per queue producer lwlock that must be held for synchronization between
consumers and the producer. Consumers must hold this lock before setting the
producer latch to ensure the producer does not miss out any signals and does
not go into unnecessary waits.

We still can't get rid of all the timeouts, especially we see that sometimes a
producer finishes and tries to unbind from the queue, even before a consumer
gets chance to connect to the queue. We left the 10s wait to allow consumers to
connect. There is still net improvement because when the consumer is not going
to connect, it tells the producer and we avoid the 10s timeout, like we used to
see earlier.
src/backend/commands/prepare.c
src/backend/executor/producerReceiver.c
src/backend/pgxc/squeue/squeue.c
src/include/pgxc/squeue.h