Re: agent_init concurrent running question

Lists: pgsql-hackers
From: Jov <amutu(at)amutu(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: agent_init concurrent running question
Date: 2014-10-20 07:29:46
Message-ID: CADyrUxOxq6zb+jeM-NUVnfXFy04JKOjRNYy7GNmYP_Fcp90dFw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

hello,I am reading the pool manager code,and have some problem:

in poolmgr.c function agent_init():

if (agent->pool)
> agent_release_connections(agent, false);

......

#ifdef XCP
> /* find database */
> agent->pool = find_database_pool(database, user_name);
> /* create if not found */
> if (agent->pool == NULL)
> agent->pool = create_database_pool(database, user_name);

in concurrent running,this function with the same dbname and
username,create_database_pool(database, user_name) may be run twice,so
there may be more than one DatabasePool in the databasePools list? But
find_database_pool(database, user_name) will always return the first
find,other may be not used,there may be memory leak?

and why this function call agent_release_connections,and then use
find_database_pool to get a new pool? For concurrent running,is it possible
one agent release the connections which other agent still is in use?

thanks!

Jov
blog: http:amutu.com/blog <http://amutu.com/blog>


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Jov <amutu(at)amutu(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: agent_init concurrent running question
Date: 2014-10-20 07:51:38
Message-ID: CAB7nPqSC2xL6eoym6Yd-6YXc8Wf4UT5VYCZeEhEGyLMzvsgQMw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Oct 20, 2014 at 4:29 PM, Jov <amutu(at)amutu(dot)com> wrote:

> in poolmgr.c function agent_init():
>
This code is part of Postgres-XC (or Postgres-XL) and not PostgreSQL
itself, you should send your questions there:
https://lists.sourceforge.net/lists/listinfo/postgres-xc-developers
Regards,
--
Michael