[Pgpool-hackers] Admin interface, statistics views, etc

Tatsuo Ishii ishii at sraoss.co.jp
Tue Aug 10 23:14:30 UTC 2010


> >> I had to fix my patch because I didn't take care the backend id. Right
> >> now, it only looks at backend 0. Not sure this is a sensible thing to
> >> do, but it would be easy to fix if it's not.
> > 
> > Can you be more specific?
> > 
> 
> Sure. In the function processes_reporting() (file
> pool_process_reporting.c), there is this code:
> 
> for (pool = 0; pool < pool_config->max_pool; pool++)
> {
>     poolBE = pool*MAX_NUM_BACKENDS;
> 
> pool is multiplied by MAX_NUM_BACKENDS to get the right pool id for the
> backend 0. If I didn't use this operation, I would access pool of
> inexisting backends.

poolBE = pool*MAX_NUM_BACKENDS points to info for backend 0.
poolBE+1 points to info for backend 1. So you would want to have inner
loop something like:

for (i = 0; i< NUM_BACKENDS;i++)
     poolBE = pool*MAX_NUM_BACKENDS + i;

Or you could use pool_coninfo_pid(proc_id, pool, i) to get the pointer
to ConnectionInfo structure. See around line 474 in pcp_child.c for
example.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp


More information about the Pgpool-hackers mailing list