pgpool2.git / summary / log / commit / refs

commit    1705efa016ed927240451612ffdb03cb3131736a
Author:   Guillaume Lelarge <guillaume at lelarge.info>
Date:     Sat Aug 14 02:16:56 2010 +0000

    Show the usual (ie, not normalized) weight with "SHOW pool_nodes".


doc/pgpool-en.html | 8 ++++---- pool_process_reporting.c | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/pgpool-en.html b/doc/pgpool-en.html index 246f04e59..ce26b76c3 100644 --- a/doc/pgpool-en.html +++ b/doc/pgpool-en.html @@ -1690,10 +1690,10 @@ if you use the load balancing mode). The possible values in the status column are explained in the <a href="#pcp_node_info">pcp_node_info reference</a>. <pre> benchs2=# show pool_nodes; - hostname | port | status | lb_weight --------------+------+--------+------------------- - 127.0.0.1 | 5432 | 2 | 1073741823.500000 - 192.168.1.7 | 5432 | 3 | 1073741823.500000 + hostname | port | status | lb_weight +-------------+------+--------+----------- + 127.0.0.1 | 5432 | 2 | 0.5 + 192.168.1.7 | 5432 | 3 | 0.5 (2 lignes) </pre> </p> diff --git a/pool_process_reporting.c b/pool_process_reporting.c index c5b8ee824..2cbc29c93 100644 --- a/pool_process_reporting.c +++ b/pool_process_reporting.c @@ -26,6 +26,7 @@ #include "pool_config.h" #include "version.h" +#include <stdlib.h> #include <string.h> #include <netinet/in.h> @@ -487,7 +488,7 @@ void config_reporting(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend) i++; snprintf(status[i].name, POOLCONFIG_MAXNAMELEN, "backend_weight%d", j); - snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%f", BACKEND_INFO(j).backend_weight); + snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%f", BACKEND_INFO(j).backend_weight/RAND_MAX); snprintf(status[i].desc, POOLCONFIG_MAXDESCLEN, "weight of backend #%d", j); i++; @@ -668,7 +669,7 @@ void nodes_reporting(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend) strncpy(nodes[i].hostname, bi->backend_hostname, strlen(bi->backend_hostname)+1); snprintf(nodes[i].port, POOLCONFIG_MAXIDENTLEN, "%d", bi->backend_port); snprintf(nodes[i].status, POOLCONFIG_MAXSTATLEN, "%d", bi->backend_status); - snprintf(nodes[i].lb_weight, POOLCONFIG_MAXWEIGHTLEN, "%f", bi->backend_weight); + snprintf(nodes[i].lb_weight, POOLCONFIG_MAXWEIGHTLEN, "%f", bi->backend_weight/RAND_MAX); } nrows = i; [parent: 6a9ed20160dc]