Hi,
Here is a patch that allows pcp_node_info and pcp_proc_info to have a
verbose ouput. Here is an example:
$ pcp_node_info --verbose 10 localhost 9898 postgres hogehoge 0
Hostname: host1
Username: 5432
Port : 1
Weight : 1073741823.500000
Comments?
--
Guillaume
http://www.postgresql.fr
http://dalibo.com
Index: doc/pgpool-en.html
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/doc/pgpool-en.html,v
retrieving revision 1.63
diff -c -p -r1.63 pgpool-en.html
*** doc/pgpool-en.html 12 Aug 2010 01:07:13 -0000 1.63
--- doc/pgpool-en.html 13 Aug 2010 20:41:32 -0000
*************** Status is represented by a digit from [0
*** 2612,2617 ****
--- 2612,2629 ----
The load balance weight is displayed in normalized format.
</p>
+ <p>
+ The --verbose option can help understand the output. For example:
+ </p>
+
+ <pre>
+ $ pcp_node_info --verbose 10 localhost 9898 postgres hogehoge 0
+ Hostname: host1
+ Username: 5432
+ Port : 1
+ Weight : 1073741823.500000
+ </pre>
+
<p>Specifying an invalid node ID will result in an error with exit
status 12, and BackendError will be displayed.</p>
*************** information will be displayed on each li
*** 2658,2663 ****
--- 2670,2701 ----
times. Timestamps are displayed in EPOCH format.
</p>
+ <p>
+ The --verbose option can help understand the output. For example:
+ </p>
+
+ <pre>
+ $ pcp_proc_info --verbose 10 localhost 9898 postgres hogehoge 3815
+ Database : postgres_db
+ Username : postgres
+ Start time : 1150769932
+ Creation time: 1150767351
+ Major : 3
+ Minor : 0
+ Counter : 1
+ PID : 1467
+ Connected : 1
+ Database : postgres_db
+ Username : postgres
+ Start time : 1150769932
+ Creation time: 1150767351
+ Major : 3
+ Minor : 0
+ Counter : 1
+ PID : 1468
+ Connected : 1
+ </pre>
+
<p>Specifying an invalid node ID will result in an error with exit
status 12, and BackendError will be displayed.</p>
Index: pcp/pcp_node_info.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pcp/pcp_node_info.c,v
retrieving revision 1.6
diff -c -p -r1.6 pcp_node_info.c
*** pcp/pcp_node_info.c 13 Aug 2010 16:48:14 -0000 1.6
--- pcp/pcp_node_info.c 13 Aug 2010 20:41:32 -0000
*************** main(int argc, char **argv)
*** 43,61 ****
BackendInfo *backend_info;
int ch;
int optindex;
static struct option long_options[] = {
{"debug", no_argument, NULL, 'd'},
{"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, 0}
};
! while ((ch = getopt_long(argc, argv, "hd", long_options, &optindex)) != -1) {
switch (ch) {
case 'd':
pcp_enable_debug();
break;
case 'h':
case '?':
default:
--- 43,67 ----
BackendInfo *backend_info;
int ch;
int optindex;
+ bool verbose = false;
static struct option long_options[] = {
{"debug", no_argument, NULL, 'd'},
{"help", no_argument, NULL, 'h'},
+ {"verbose", no_argument, NULL, 'v'},
{NULL, 0, NULL, 0}
};
! while ((ch = getopt_long(argc, argv, "hdv", long_options, &optindex)) != -1) {
switch (ch) {
case 'd':
pcp_enable_debug();
break;
+ case 'v':
+ verbose = true;
+ break;
+
case 'h':
case '?':
default:
*************** main(int argc, char **argv)
*** 134,144 ****
pcp_disconnect();
myexit(errorcode);
} else {
! printf("%s %d %d %f\n",
! backend_info->backend_hostname,
! backend_info->backend_port,
! backend_info->backend_status,
! backend_info->backend_weight);
free(backend_info);
}
--- 140,159 ----
pcp_disconnect();
myexit(errorcode);
} else {
! if (verbose)
! {
! printf("Hostname: %s\nPort : %d\nStatus : %d\nWeight : %f\n",
! backend_info->backend_hostname,
! backend_info->backend_port,
! backend_info->backend_status,
! backend_info->backend_weight);
! } else {
! printf("%s %d %d %f\n",
! backend_info->backend_hostname,
! backend_info->backend_port,
! backend_info->backend_status,
! backend_info->backend_weight);
! }
free(backend_info);
}
Index: pcp/pcp_proc_info.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pcp/pcp_proc_info.c,v
retrieving revision 1.8
diff -c -p -r1.8 pcp_proc_info.c
*** pcp/pcp_proc_info.c 13 Aug 2010 16:48:14 -0000 1.8
--- pcp/pcp_proc_info.c 13 Aug 2010 20:41:32 -0000
*************** main(int argc, char **argv)
*** 44,62 ****
int array_size;
int ch;
int optindex;
static struct option long_options[] = {
{"debug", no_argument, NULL, 'd'},
{"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, 0}
};
! while ((ch = getopt_long(argc, argv, "hd", long_options, &optindex)) != -1) {
switch (ch) {
case 'd':
pcp_enable_debug();
break;
case 'h':
case '?':
default:
--- 44,68 ----
int array_size;
int ch;
int optindex;
+ bool verbose = false;
static struct option long_options[] = {
{"debug", no_argument, NULL, 'd'},
{"help", no_argument, NULL, 'h'},
+ {"verbose", no_argument, NULL, 'v'},
{NULL, 0, NULL, 0}
};
! while ((ch = getopt_long(argc, argv, "hdv", long_options, &optindex)) != -1) {
switch (ch) {
case 'd':
pcp_enable_debug();
break;
+ case 'v':
+ verbose = true;
+ break;
+
case 'h':
case '?':
default:
*************** main(int argc, char **argv)
*** 141,157 ****
if (process_info->connection_info[i].database[0] == '\0')
continue;
! printf("%s %s %ld %ld %d %d %d %d %d\n",
! process_info->connection_info[i].database,
! process_info->connection_info[i].user,
! process_info->start_time,
! process_info->connection_info[i].create_time,
! process_info->connection_info[i].major,
! process_info->connection_info[i].minor,
! process_info->connection_info[i].counter,
! process_info->connection_info[i].pid,
! process_info->connection_info[i].connected);
! }
free(process_info);
}
--- 147,177 ----
if (process_info->connection_info[i].database[0] == '\0')
continue;
! if (verbose)
! {
! printf("Database : %s\nUsername : %s\nStart time : %ld\nCreation time: %ld\nMajor : %d\nMinor : %d\nCounter : %d\nPID : %d\nConnected : %d\n",
! process_info->connection_info[i].database,
! process_info->connection_info[i].user,
! process_info->start_time,
! process_info->connection_info[i].create_time,
! process_info->connection_info[i].major,
! process_info->connection_info[i].minor,
! process_info->connection_info[i].counter,
! process_info->connection_info[i].pid,
! process_info->connection_info[i].connected);
! } else {
! printf("%s %s %ld %ld %d %d %d %d %d\n",
! process_info->connection_info[i].database,
! process_info->connection_info[i].user,
! process_info->start_time,
! process_info->connection_info[i].create_time,
! process_info->connection_info[i].major,
! process_info->connection_info[i].minor,
! process_info->connection_info[i].counter,
! process_info->connection_info[i].pid,
! process_info->connection_info[i].connected);
! }
! }
free(process_info);
}
_______________________________________________
Pgpool-hackers mailing list
[email protected]
http://pgfoundry.org/mailman/listinfo/pgpool-hackers