Re: Suggestions on message transfer among backends - Mailing list pgsql-hackers

From Andy Fan
Subject Re: Suggestions on message transfer among backends
Date
Msg-id CAKU4AWpLoVLkUO_7Qd7XAbcw4ox3x71bSOp=5FdUJgAUdLDDJA@mail.gmail.com
Whole thread Raw
In response to Re: Suggestions on message transfer among backends  (Andrey Lepikhov <a.lepikhov@postgrespro.ru>)
Responses Re: Suggestions on message transfer among backends
Re: Suggestions on message transfer among backends
List pgsql-hackers
On Tue, Mar 12, 2019 at 1:59 PM Andrey Lepikhov <a.lepikhov@postgrespro.ru> wrote:
On 11/03/2019 18:36, Andy Fan wrote:
> Hi:
>    I need some function which requires some message exchange among
> different back-ends (connections).
> specially I need a shared hash map and a message queue.
>
> Message queue:  it should be many writers,  1 reader.   Looks POSIX
> message queue should be OK, but postgre doesn't use it.  is there any
> equivalent in PG?
>
> shared hash map:  the number of items can be fixed and the value can be
> fixed as well.
>
> any keywords or explanation will be extremely helpful.
You may use shm_mq (shared memory queue) and hash tables (dynahash.c) in
shared memory (see ShmemInitHash() + shmem_startup_hook)
>
> Thanks

--
Andrey Lepikhov
Postgres Professional
https://postgrespro.com
The Russian Postgres Company

Thanks Andrey and all people replied this!   dynahash/ShmemInitHash is the one I'm using and it is ok for my purposes. 
I planned to use posix/system v  message queue,   since they are able to support multi readers/multi writer.   
I just don't know why shm_mq is designed to single-reader & single-writer. 

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Making all nbtree entries unique by having heap TIDs participatein comparisons
Next
From: pavan gudivada
Date:
Subject: GSOC Application