Обсуждение: pgsql: Extend shm_mq API with new functions shm_mq_sendv, shm_mq_set_ha

Поиск
Список
Период
Сортировка

pgsql: Extend shm_mq API with new functions shm_mq_sendv, shm_mq_set_ha

От
Robert Haas
Дата:
Extend shm_mq API with new functions shm_mq_sendv, shm_mq_set_handle.

shm_mq_sendv sends a message to the queue assembled from multiple
locations.  This is expected to be used by forthcoming patches to
allow frontend/backend protocol messages to be sent via shm_mq, but
might be useful for other purposes as well.

shm_mq_set_handle associates a BackgroundWorkerHandle with an
already-existing shm_mq_handle.  This solves a timing problem when
creating a shm_mq to communicate with a newly-launched background
worker: if you attach to the queue first, and the background worker
fails to start, you might block forever trying to do I/O on the queue;
but if you start the background worker first, but then die before
attaching to the queue, the background worrker might block forever
trying to do I/O on the queue.  This lets you attach before starting
the worker (so that the worker is protected) and then associate the
BackgroundWorkerHandle later (so that you are also protected).

Patch by me, reviewed by Stephen Frost.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/7bb0e97407c32cbf7245ef91fcc27d120c81e872

Modified Files
--------------
src/backend/storage/ipc/shm_mq.c |  126 +++++++++++++++++++++++++++++++++-----
src/include/storage/shm_mq.h     |   14 ++++-
2 files changed, 124 insertions(+), 16 deletions(-)