Re: Shared Data Structure b/w clients

Lists: pgsql-hackers
From: Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Shared Data Structure b/w clients
Date: 2014-07-22 18:03:35
Message-ID: CANqGtSuzqXF_A=B5FK6up2D4-2QQ=Rfx2rnUgRWUdBqWBdT+Nw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi All,

I am working on postgresql code and having some problem. :)

I need to create shared data structure, so that different client and
connection can update and share the state of those data structures in
memory. I planned to use top memory context but it can give me shared
structure within one session/terminal.

Please tel me how postgresql do that and how i can do that?

Regards,
Rohit Goyal


From: Atri Sharma <atri(dot)jiit(at)gmail(dot)com>
To: Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Shared Data Structure b/w clients
Date: 2014-07-22 18:30:12
Message-ID: CAOeZVicDffLk1RZr0DDegbaEOw_8jyao9GRRzZwZ6+qzmdPZ_A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tuesday, July 22, 2014, Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com> wrote:

> Hi All,
>
> I am working on postgresql code and having some problem. :)
>
> I need to create shared data structure, so that different client and
> connection can update and share the state of those data structures in
> memory. I planned to use top memory context but it can give me shared
> structure within one session/terminal.
>
> Please tel me how postgresql do that and how i can do that?
>
> Regards,
> Rohit Goyal
>

How about making it a part of shared mem, like shared buffers?

Regards,

Atri

--
Regards,

Atri
*l'apprenant*


From: Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com>
To: Atri Sharma <atri(dot)jiit(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Shared Data Structure b/w clients
Date: 2014-07-22 18:33:53
Message-ID: CANqGtSvEAr6ezTPFC6-Wy=-Ns9nU2xkXTgbWAU98mJdQdn6wMQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi Atri/All,

I am very new in postgresql code. Can you please help in a bit detail ortel
me how to create structure in shared memory(shared buffer).

It would be really easy for me if you can give me a code snippet or any
link to follow.

Regards,
Rohit Goyal

On Tue, Jul 22, 2014 at 8:30 PM, Atri Sharma <atri(dot)jiit(at)gmail(dot)com> wrote:

>
>
> On Tuesday, July 22, 2014, Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com> wrote:
>
>> Hi All,
>>
>> I am working on postgresql code and having some problem. :)
>>
>> I need to create shared data structure, so that different client and
>> connection can update and share the state of those data structures in
>> memory. I planned to use top memory context but it can give me shared
>> structure within one session/terminal.
>>
>> Please tel me how postgresql do that and how i can do that?
>>
>> Regards,
>> Rohit Goyal
>>
>
> How about making it a part of shared mem, like shared buffers?
>
> Regards,
>
> Atri
>
>
> --
> Regards,
>
> Atri
> *l'apprenant*
>
>

--
Regards,
Rohit Goyal


From: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
To: Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com>
Cc: Atri Sharma <atri(dot)jiit(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Shared Data Structure b/w clients
Date: 2014-07-22 21:11:18
Message-ID: CAJKUy5g_MKOE-P-nokdi6DSyOtEd3DC6nQt=TdL29VTgj=eeVA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Jul 22, 2014 at 1:33 PM, Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com> wrote:
> Hi Atri/All,
>
> I am very new in postgresql code. Can you please help in a bit detail ortel
> me how to create structure in shared memory(shared buffer).
>
> It would be really easy for me if you can give me a code snippet or any link
> to follow.
>

you can look at contrib/pg_stat_statements

--
Jaime Casanova www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitaciĆ³n
Phone: +593 4 5107566 Cell: +593 987171157


From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com>, Atri Sharma <atri(dot)jiit(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Shared Data Structure b/w clients
Date: 2014-07-23 01:46:14
Message-ID: 53CF13E6.2000806@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 07/23/2014 02:33 AM, Rohit Goyal wrote:
>
> I am very new in postgresql code. Can you please help in a bit detail
> ortel me how to create structure in shared memory(shared buffer).
>
> It would be really easy for me if you can give me a code snippet or any
> link to follow.
>

There's a lot of detail on how to do this in the BDR codebase, see
contrib/bdr in
http://git.postgresql.org/gitweb/?p=2ndquadrant_bdr.git;a=summary

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com>, Atri Sharma <atri(dot)jiit(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Shared Data Structure b/w clients
Date: 2014-07-23 01:49:14
Message-ID: 53CF149A.10202@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 07/23/2014 09:46 AM, Craig Ringer wrote:
> There's a lot of detail on how to do this in the BDR codebase, see
> contrib/bdr in
> http://git.postgresql.org/gitweb/?p=2ndquadrant_bdr.git;a=summary

Oh, sorry: in the bdr-next branch. Should've mentioned.

http://git.postgresql.org/gitweb/?p=2ndquadrant_bdr.git;a=tree;f=contrib/bdr;h=fad1aa59a15724deb98f9b923d84f0ce818afc1f;hb=refs/heads/bdr-next

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services