[Pgpool-hackers] First pcp command as PostgreSQL function

Tatsuo Ishii ishii at sraoss.co.jp
Tue Apr 19 09:35:56 UTC 2011


> On 04/04/2011 09:54, Jehan-Guillaume (ioguix) de Rorthais wrote:
>> On 03/04/2011 01:38, Tatsuo Ishii wrote:
>>>> Hello,
>>>>
>>>> Following our previous discussions I created a PostgreSQL contrib module
>>>> which brings pgpool's pcp command as function in PostgreSQL. I called it
>>>> pgpool_adm, any better ideas ?
>> 
>>> Great! I think "pgpool_adm" is fine.
>> 
>> ok !
>> 
>>>> As a first step, I decided to focus on one function only: pcp_node_info.
>>>> I'll add other ones as soon as this one will be committable.
>> 
>>> I see. BTW, are you going to implement a function for "show
>>> pool_status"?
>> 
>> AFAICS, pool_status is not a pcp command. So as a first step, we would
>> have to refactor this code to move it from pgPool core to the pcp library.
>> 
>> I'll give it a try, unless you are able to manage that faster than me ?
> 
> Ok, I had a look on that. I think we should split the 5 functions in
> pool_process_reporting.c (config, nodes, pools, processes and version)
> and split them with logic on a side and output on the other side.
> 
> Then, I guess I'll be able from to use the logical part of these
> functions from the pcp code and add 5 new pcp command.
> 
> I'm starting the work.
> 
> Comments ?

Sounds nice idea.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp

>>>> INSTALL: (tested against current 9.1devel HEAD)
>>>>
>>>>   $ cd $PGSRC/contrib
>>>>   $ tar zxf pgpool_adm.tgz
>>>>   $ cd pgpool_adm
>>>>   $ make && sudo make install
>>>>
>>>> then:
>>>>
>>>>   $ psql pgpool
>>>>   CREATE SCHEMA pgpool;
>>>>   CREATE EXTENSION pgpool_adm WITH SCHEMA pgpool ;
>>>>   SELECT * FROM pgpool.pcp_node_info(0, 'localhost', 10, 9898,
>>>> 'pgpool_adm', 'password');
>>>>      host    | port |             status              |   weight
>>>>   -----------+------+---------------------------------+-------------
>>>>    localhost | 5491 | Waiting for connection to start | 1.46602e+13
>>>>   (1 ligne)
>>>>
>>>> If you don't want/cannot test with 9.1, just adapt and run the "CREATE
>>>> FUNCTION" query located in pgpool_adm/pgpool_adm--1.0.sql.
>>>>
>>>> NOTE:
>>>> I had to mess a bit to make the compilation work out of the box because
>>>> of my setup of pgpool installing stuffs in /usr/local/{lib,include}.
>>>> Basically editing my system ldd setup and configuring postgresql with
>>>> "--with-libraries" and "--with-includes". Drop me a mail if you have any
>>>> trouble.
>>>>
>>>> TODO:
>>>>   * I will try to make it work with foreign server and user mappings so
>>>> we will not have to give all servers parameters (host, port, timeout),
>>>> but most importantly, not have to write in clear text authentication
>>>> parameters.
>>>>   * Why do we backend_weight/RAND_MAX in the code ?
>> 
>>> To normalize backend weight.
>> 
>>>> Feedback & comments ?
>>>> - -- 
>>>> Jehan-Guillaume (ioguix) de Rorthais
>>>> DBA
>>>> http://www.dalibo.com
>>>> 
> 
> _______________________________________________
> Pgpool-hackers mailing list
> Pgpool-hackers at pgfoundry.org
> http://pgfoundry.org/mailman/listinfo/pgpool-hackers
> 
> - -- 
> Jehan-Guillaume (ioguix) de Rorthais
> DBA
> http://www.dalibo.com
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAk2tVBAACgkQXu9L1HbaT6LQXQCgvhdVwU0syHpw5nbpE5tLzp7X
> t4wAoJImoj21yFYX477fR9uePGzQAB43
> =cWEh
> -----END PGP SIGNATURE-----


More information about the Pgpool-hackers mailing list