[pgpool-hackers: 4014] Re: Proposal: add connection count to pcp_proc_info and show pool_process
Tatsuo Ishii
ishii at sraoss.co.jp
Mon Sep 6 17:06:07 JST 2021
> Hi Ishii-san,
>
> I was mistaken about the output of pcp_proc_info. My patch was behaving
> as expected.
>
> I updated the documents of pcp_proc_info, show pool_processes and
> show pool_pools. Could you check them?
Sure.
diff --git a/src/include/pcp/libpcp_ext.h b/src/include/pcp/libpcp_ext.h
index b62c3b2..237d894 100644
--- a/src/include/pcp/libpcp_ext.h
+++ b/src/include/pcp/libpcp_ext.h
@@ -118,6 +118,14 @@ typedef struct
BackendInfo backend_info[MAX_NUM_BACKENDS];
} BackendDesc;
+typedef enum
+{
+ WAIT_FOR_CONNECT,
+ COMMAND_EXECUTE,
+ IDLE,
+ IDLE_IN_TRANS
+} ProcessStatus;
+
/*
* Connection pool information. Placed on shared memory area.
*/
@@ -132,6 +140,9 @@ typedef struct
int key; /* cancel key */
int counter; /* used counter */
time_t create_time; /* connection creation time */
+ time_t client_connection_time; /* client connection time */
+ time_t client_disconnection_time; /* client last disconnection time */
+ int client_idle_duration; /* client idle duration time(s) */
It would better to have a space between "time" and "(s").
+ 5136 | 2021-09-02 04:54:18 (remaining: 1:58) | 1 | 0 | 1 | postgres | postgres | 2021-09-02 04:55:34 | 2021-09-02 04:55:34 | 2021-09-02 04:55:32 | 0 | 3 | 0 | 1 | 5192 | 1 | Idle
Actually I expected that "remaining" shows the remaining time before
client_idle_limit expires. Suppose client_idle_limit = 300. If clent
is idle for 100 seconds, "remaining" should be 300 - 100 = 200 seconds
= 3:20.
You can caliculate the value by:
pool_config->client_idle_limit - backend->info->client_idle_duration.
--
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