-->
例を示します。
<programlisting>
-$ pcp_proc_info -p 11001 2871
-postgres postgres 2021-09-07 02:12:53 (remaining: 0:27) 1 3 0 2021-09-07 02:16:59 2021-09-07 02:16:59 273 2021-09-07 02:16:56 1 3016 1 2871 0 Idle
-postgres postgres 2021-09-07 02:12:53 (remaining: 0:27) 1 3 0 2021-09-07 02:16:59 2021-09-07 02:16:59 0 2021-09-07 02:16:56 1 3017 1 2871 1 Idle
+$ pcp_proc_info -p 1100
+test postgres 2021-09-28 04:16:00 (4:56 before process restarting) 1 3 0 2021-09-28 04:16:16 2021-09-28 04:16:16 0 2021-09-28 04:16:33 1 30795 0 30750 0 Wait for connection
+test postgres 2021-09-28 04:16:00 (4:56 before process restarting) 1 3 0 2021-09-28 04:16:16 2021-09-28 04:16:16 0 2021-09-28 04:16:33 1 30796 0 30750 1 Wait for connection
+test kawamoto 2021-09-28 04:16:00 0 3 0 2021-09-28 04:16:03 2021-09-28 04:16:03 34 (4:26 before client disconnected) 1 30763 1 30751 0 Idle
+test kawamoto 2021-09-28 04:16:00 0 3 0 2021-09-28 04:16:03 2021-09-28 04:16:03 34 (4:26 before client disconnected) 1 30764 1 30751 1 Idle
+$ pcp_proc_info -p 11001 30751
+test kawamoto 2021-09-28 04:16:00 0 3 0 2021-09-28 04:16:03 2021-09-28 04:16:03 58 (4:02 before client disconnected) 1 30763 1 30751 0 Idle
+test kawamoto 2021-09-28 04:16:00 0 3 0 2021-09-28 04:16:03 2021-09-28 04:16:03 58 (4:02 before client disconnected) 1 30764 1 30751 1 Idle
</programlisting>
</para>
<para>
<!--
1. connected database name
2. connected user name
- 3. process start-up timestamp (remaining time by <xref linkend="guc-client-idle-limit">. If client_idle_limit is set 0, remaining is not desplayed.)
+ 3. process start-up timestamp (If <xref linkend="guc-child-life-time"> is set not 0, the time before process restarting is displayed.)
4. process-reuse counter for <xref linkend="guc-child-max-connections">
5. protocol major version
6. protocol minor version
7. connection created timestamp
8. last client connected timestamp
- 9. client idle duration (sec) for <xref linkend="guc-client-idle-limit">
+ 9. client idle duration (sec) (If <xref linkend="guc-client-idle-limit"> is set not 0, the time before client disconnected is displayed.)
10. last client disconnected timestamp
11. connection-reuse counter
12. PostgreSQL backend process id
-->
1. 接続先のデータベース名
2. 接続先のユーザ名
- 3. Pgpool-IIプロセスの起動時刻 (<xref linkend="guc-client-idle-limit">による残り時間。client_idle_limitが0の場合、remainingは表示されません)
+ 3. Pgpool-IIプロセスの起動時刻 (<xref linkend="guc-child-life-time">が0でない場合、プロセスが再起動されるまでの時間を表示します)
4. プロセスの利用カウンタ(<xref linkend="guc-child-max-connections">を参照)
5. プロトコルのメジャーバージョン
6. プロトコルのマイナーバージョン
7. バックエンドへの接続時刻
8. クライアントが最後に接続開始した時刻
- 9. æ\8e¥ç¶\9aã\81\8cidleã\81¨ã\81ªã\81£ã\81¦ã\81\84ã\82\8bæ\99\82é\96\93(ç§\92)(<xref linkend="guc-client-idle-limit">ã\82\92å\8f\82ç\85§)
+ 9. æ\8e¥ç¶\9aã\81\8cidleã\81¨ã\81ªã\81£ã\81¦ã\81\84ã\82\8bæ\99\82é\96\93(ç§\92)(<xref linkend="guc-client-idle-limit">ã\81\8c0ã\81§ã\81ªã\81\84å ´å\90\88ã\80\81ã\82¯ã\83©ã\82¤ã\82¢ã\83³ã\83\88ã\81\8cå\88\87æ\96ã\81\95ã\82\8cã\82\8bã\81¾ã\81§ã\81®æ\99\82é\96\93ã\82\92表示ã\81\97ã\81¾ã\81\99)
10. クライアントが最後に接続終了した時刻
11. 接続の再利用カウンタ値
12. PostgreSQLバックエンドプロセスのプロセスID
<option>--verbose</option> オプションは出力内容を理解するのに役に立ちます。例:
</para>
<programlisting>
-$ pcp_proc_info -p 11001 --verbose 2871
-Database : postgres
+$ pcp_proc_info -p 11001 --verbose
+Database : test
Username : postgres
-Start time : 2021-09-07 02:12:53 (remaining: 3:36)
+Start time : 2021-09-28 04:16:00 (2:52 before process restarting)
Client connection count : 1
Major : 3
Minor : 0
-Backend connection time : 2021-09-07 02:16:59
-Client connection time : 2021-09-07 02:16:59
-Client idle duration : 84
-Client disconnection time : 2021-09-07 02:16:56
+Backend connection time : 2021-09-28 04:16:16
+Client connection time : 2021-09-28 04:16:16
+Client idle duration : 0
+Client disconnection time : 2021-09-28 04:16:33
Pool Counter : 1
-Backend PID : 3016
-Connected : 1
-PID : 2871
+Backend PID : 30795
+Connected : 0
+PID : 30750
Backend ID : 0
-Status : Idle
+Status : Wait for connection
-Database : postgres
+Database : test
Username : postgres
-Start time : 2021-09-07 02:12:53 (remaining: 3:36)
+Start time : 2021-09-28 04:16:00 (2:52 before process restarting)
Client connection count : 1
Major : 3
Minor : 0
-Backend connection time : 2021-09-07 02:16:59
-Client connection time : 2021-09-07 02:16:59
+Backend connection time : 2021-09-28 04:16:16
+Client connection time : 2021-09-28 04:16:16
Client idle duration : 0
-Client disconnection time : 2021-09-07 02:16:56
+Client disconnection time : 2021-09-28 04:16:33
+Pool Counter : 1
+Backend PID : 30796
+Connected : 0
+PID : 30750
+Backend ID : 1
+Status : Wait for connection
+
+Database : test
+Username : kawamoto
+Start time : 2021-09-28 04:16:00
+Client connection count : 0
+Major : 3
+Minor : 0
+Backend connection time : 2021-09-28 04:16:03
+Client connection time : 2021-09-28 04:16:03
+Client idle duration : 158 (2:22 before client disconnected)
+Client disconnection time :
+Pool Counter : 1
+Backend PID : 30763
+Connected : 1
+PID : 30751
+Backend ID : 0
+Status : Idle
+
+Database : test
+Username : kawamoto
+Start time : 2021-09-28 04:16:00
+Client connection count : 0
+Major : 3
+Minor : 0
+Backend connection time : 2021-09-28 04:16:03
+Client connection time : 2021-09-28 04:16:03
+Client idle duration : 158 (2:22 before client disconnected)
+Client disconnection time :
Pool Counter : 1
-Backend PID : 3017
+Backend PID : 30764
Connected : 1
-PID : 2871
+PID : 30751
Backend ID : 1
Status : Idle
</programlisting>
<listitem>
<para>
<!--
- <literal>remaining</literal> is the remaining time by
- <xref linkend="guc-client-idle-limit">. If
- <literal>client_idle_limit</literal> is set 0,
- <literal>remaining</literal> is not desplayed.
+ If <xref linkend="guc-child-life-time"> is set not 0,
+ the time before process restarting is displayed.
-->
- <literal>remaining</literal> は <xref linkend="guc-client-idle-limit"> に
- よる残り時間です。<literal>client_idle_limit</literal> が 0 の場合、
- <literal>remaining</literal> は表示されません。
+ <xref linkend="guc-child-life-time"> が0でない場合
+ プロセスが再起動されるまでの時間が表示されます。
</para>
</listitem>
</itemizedlist>
-->
<literal>client_idle_duration</literal> はクライアントからのコマンドを待機している時間(秒)です。
</para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <!--
+ If <xref linkend="guc-client-idle-limit"> is set not 0,
+ the time before client disconnected is displayed.
+ -->
+ <xref linkend="guc-client-idle-limit"> が0でない場合
+ クライアントが切断されるまでの時間が表示されます。
+ </para>
+ </listitem>
+ </itemizedlist>
</listitem>
<listitem>
返却行数は常に <xref linkend="guc-num-init-children"> * <xref linkend="guc-max-pool"> * 「バックエンドの数」になります。
ここでは例を示します。
<programlisting>
-postgres=# show pool_pools;
- pool_pid | start_time | client_connection_count | pool_id | backend_id | database | username | backend_connection_time | client_connection_time | client_disconnection_time | client_idle_duration | majorversion | minorversion | pool_counter | pool_backendpid | pool_connected | status
-----------+---------------------------------------+-------------------------+---------+------------+----------+----------+-------------------------+------------------------+---------------------------+----------------------+--------------+--------------+--------------+-----------------+----------------+---------------------
- 3727 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3727 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3727 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3727 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3727 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3727 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3727 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3727 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3728 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3728 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3728 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3728 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3728 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3728 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3728 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3728 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3729 | 2021-09-07 02:29:38 (remaining: 3:30) | 1 | 0 | 0 | postgres | postgres | 2021-09-07 02:29:47 | 2021-09-07 02:29:47 | 2021-09-07 02:29:46 | 90 | 3 | 0 | 1 | 3749 | 1 | Idle
- 3729 | 2021-09-07 02:29:38 (remaining: 3:30) | 1 | 0 | 1 | postgres | postgres | 2021-09-07 02:29:47 | 2021-09-07 02:29:47 | 2021-09-07 02:29:46 | 0 | 3 | 0 | 1 | 3750 | 1 | Idle
- 3729 | 2021-09-07 02:29:38 (remaining: 3:30) | 1 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
- 3729 | 2021-09-07 02:29:38 (remaining: 3:30) | 1 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
- 3729 | 2021-09-07 02:29:38 (remaining: 3:30) | 1 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
- 3729 | 2021-09-07 02:29:38 (remaining: 3:30) | 1 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
- 3729 | 2021-09-07 02:29:38 (remaining: 3:30) | 1 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
- 3729 | 2021-09-07 02:29:38 (remaining: 3:30) | 1 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
- 3730 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3730 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3730 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3730 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3730 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3730 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3730 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3730 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3731 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3731 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3731 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3731 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3731 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3731 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3731 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3731 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3732 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3732 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3732 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3732 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3732 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3732 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3732 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3732 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3733 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3733 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3733 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3733 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3733 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3733 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3733 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3733 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3734 | 2021-09-07 02:29:38 (remaining: 5:00) | 4 | 0 | 0 | postgres | postgres | 2021-09-07 02:31:22 | 2021-09-07 02:31:22 | 2021-09-07 02:31:15 | 0 | 3 | 0 | 1 | 3823 | 1 | Execute command
- 3734 | 2021-09-07 02:29:38 (remaining: 5:00) | 4 | 0 | 1 | postgres | postgres | 2021-09-07 02:31:22 | 2021-09-07 02:31:22 | 2021-09-07 02:31:15 | 0 | 3 | 0 | 1 | 3824 | 1 | Execute command
- 3734 | 2021-09-07 02:29:38 (remaining: 5:00) | 4 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
- 3734 | 2021-09-07 02:29:38 (remaining: 5:00) | 4 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
- 3734 | 2021-09-07 02:29:38 (remaining: 5:00) | 4 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
- 3734 | 2021-09-07 02:29:38 (remaining: 5:00) | 4 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
- 3734 | 2021-09-07 02:29:38 (remaining: 5:00) | 4 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
- 3734 | 2021-09-07 02:29:38 (remaining: 5:00) | 4 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
+test=# show pool_pools;
+ pool_pid | start_time | client_connection_count | pool_id | backend_id | database | username | backend_connection_time | client_connection_time | client_disconnection_time | client_idle_duration | majorversion | minorversion | pool_counter | pool_backendpid | pool_connected | status
+----------+---------------------+-------------------------+---------+------------+----------+----------+-------------------------+------------------------+---------------------------+--------------------------------------+--------------+--------------+--------------+-----------------+----------------+---------------------
+ 32641 | 2021-09-28 04:40:45 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32641 | 2021-09-28 04:40:45 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32641 | 2021-09-28 04:40:45 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32641 | 2021-09-28 04:40:45 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32641 | 2021-09-28 04:40:45 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32641 | 2021-09-28 04:40:45 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32641 | 2021-09-28 04:40:45 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32641 | 2021-09-28 04:40:45 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32643 | 2021-09-28 04:40:45 | 0 | 0 | 0 | test | kawamoto | 2021-09-28 04:40:48 | 2021-09-28 04:40:48 | | 41 (4:19 before client disconnected) | 3 | 0 | 1 | 32660 | 1 | Idle
+ 32643 | 2021-09-28 04:40:45 | 0 | 0 | 1 | test | kawamoto | 2021-09-28 04:40:48 | 2021-09-28 04:40:48 | | 41 (4:19 before client disconnected) | 3 | 0 | 1 | 32661 | 1 | Idle
+ 32643 | 2021-09-28 04:40:45 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
+ 32643 | 2021-09-28 04:40:45 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
+ 32643 | 2021-09-28 04:40:45 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
+ 32643 | 2021-09-28 04:40:45 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
+ 32643 | 2021-09-28 04:40:45 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
+ 32643 | 2021-09-28 04:40:45 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
+ 32644 | 2021-09-28 04:40:45 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32644 | 2021-09-28 04:40:45 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32644 | 2021-09-28 04:40:45 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32644 | 2021-09-28 04:40:45 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32644 | 2021-09-28 04:40:45 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32644 | 2021-09-28 04:40:45 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32644 | 2021-09-28 04:40:45 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32644 | 2021-09-28 04:40:45 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32645 | 2021-09-28 04:40:45 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32645 | 2021-09-28 04:40:45 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32645 | 2021-09-28 04:40:45 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32645 | 2021-09-28 04:40:45 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32645 | 2021-09-28 04:40:45 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32645 | 2021-09-28 04:40:45 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32645 | 2021-09-28 04:40:45 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32645 | 2021-09-28 04:40:45 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32648 | 2021-09-28 04:40:45 | 1 | 0 | 0 | test | postgres | 2021-09-28 04:40:52 | 2021-09-28 04:40:52 | 2021-09-28 04:40:59 | 0 | 3 | 0 | 1 | 32681 | 0 | Execute command
+ 32648 | 2021-09-28 04:40:45 | 1 | 0 | 1 | test | postgres | 2021-09-28 04:40:52 | 2021-09-28 04:40:52 | 2021-09-28 04:40:59 | 0 | 3 | 0 | 1 | 32682 | 0 | Execute command
+ 32648 | 2021-09-28 04:40:45 | 1 | 1 | 0 | test | kawamoto | 2021-09-28 04:41:30 | 2021-09-28 04:41:30 | | 0 (5:00 before client disconnected) | 3 | 0 | 1 | 32746 | 1 | Execute command
+ 32648 | 2021-09-28 04:40:45 | 1 | 1 | 1 | test | kawamoto | 2021-09-28 04:41:30 | 2021-09-28 04:41:30 | | 0 (5:00 before client disconnected) | 3 | 0 | 1 | 32747 | 1 | Execute command
+ 32648 | 2021-09-28 04:40:45 | 1 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
+ 32648 | 2021-09-28 04:40:45 | 1 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
+ 32648 | 2021-09-28 04:40:45 | 1 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
+ 32648 | 2021-09-28 04:40:45 | 1 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
(64 rows)
</programlisting>
<listitem>
<para>
<!--
- <literal>remaining</literal> is the remaining time by
- <xref linkend="guc-client-idle-limit">. If
- <literal>client_idle_limit</literal> is set 0,
- <literal>remaining</literal> is not desplayed.
+ If <xref linkend="guc-child-life-time"> is set not 0,
+ the time before process restarting is displayed.
-->
- <literal>remaining</literal> は <xref linkend="guc-client-idle-limit"> に
- よる残り時間です。<literal>client_idle_limit</literal> が 0 の場合、
- <literal>remaining</literal> は表示されません。
+ <xref linkend="guc-child-life-time"> が0出ない場合
+ プロセスが再起動されるまでの時間が表示されます。
</para>
</listitem>
</itemizedlist>
ここでは例を示します。
<programlisting>
-postgres=# show pool_processes;
- pool_pid | start_time | client_connection_count | database | username | backend_connection_time | pool_counter | status
-----------+---------------------------------------+-------------------------+----------+----------+-------------------------+--------------+---------------------
- 6685 | 2021-09-07 02:41:13 (remaining: 5:00) | 0 | | | | | Wait for connection
- 6686 | 2021-09-07 02:41:13 (remaining: 5:00) | 0 | | | | | Wait for connection
- 6687 | 2021-09-07 02:41:13 (remaining: 5:00) | 0 | | | | | Wait for connection
- 6688 | 2021-09-07 02:41:13 (remaining: 4:10) | 1 | postgres | postgres | 2021-09-07 02:41:48 | 1 | Idle
- 6689 | 2021-09-07 02:41:13 (remaining: 5:00) | 0 | | | | | Wait for connection
- 6690 | 2021-09-07 02:41:13 (remaining: 5:00) | 0 | | | | | Wait for connection
- 6691 | 2021-09-07 02:41:13 (remaining: 5:00) | 0 | | | | | Wait for connection
- 6692 | 2021-09-07 02:41:13 (remaining: 5:00) | 2 | postgres | postgres | 2021-09-07 02:42:38 | 1 | Execute command
+test=# show pool_processes;
+ pool_pid | start_time | client_connection_count | database | username | backend_connection_time | pool_counter | status
+----------+------------------------------------------------------+-------------------------+----------+----------+-------------------------+--------------+---------------------
+ 32641 | 2021-09-28 04:40:45 | 0 | | | | | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | | | | | Wait for connection
+ 32643 | 2021-09-28 04:40:45 | 0 | test | kawamoto | 2021-09-28 04:40:48 | 1 | Idle
+ 32644 | 2021-09-28 04:40:45 | 0 | test | kawamoto | 2021-09-28 04:43:15 | 1 | Execute command
+ 32645 | 2021-09-28 04:40:45 | 0 | | | | | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | | | | | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | | | | | Wait for connection
+ 32648 | 2021-09-28 04:40:45 (3:15 before process restarting) | 2 | | | | | Wait for connection
(8 rows)
</programlisting>
</para>
<para>
Here is an example output:
<programlisting>
-$ pcp_proc_info -p 11001 2871
-postgres postgres 2021-09-07 02:12:53 (remaining: 0:27) 1 3 0 2021-09-07 02:16:59 2021-09-07 02:16:59 273 2021-09-07 02:16:56 1 3016 1 2871 0 Idle
-postgres postgres 2021-09-07 02:12:53 (remaining: 0:27) 1 3 0 2021-09-07 02:16:59 2021-09-07 02:16:59 0 2021-09-07 02:16:56 1 3017 1 2871 1 Idle
+$ pcp_proc_info -p 1100
+test postgres 2021-09-28 04:16:00 (4:56 before process restarting) 1 3 0 2021-09-28 04:16:16 2021-09-28 04:16:16 0 2021-09-28 04:16:33 1 30795 0 30750 0 Wait for connection
+test postgres 2021-09-28 04:16:00 (4:56 before process restarting) 1 3 0 2021-09-28 04:16:16 2021-09-28 04:16:16 0 2021-09-28 04:16:33 1 30796 0 30750 1 Wait for connection
+test kawamoto 2021-09-28 04:16:00 0 3 0 2021-09-28 04:16:03 2021-09-28 04:16:03 34 (4:26 before client disconnected) 1 30763 1 30751 0 Idle
+test kawamoto 2021-09-28 04:16:00 0 3 0 2021-09-28 04:16:03 2021-09-28 04:16:03 34 (4:26 before client disconnected) 1 30764 1 30751 1 Idle
+$ pcp_proc_info -p 11001 30751
+test kawamoto 2021-09-28 04:16:00 0 3 0 2021-09-28 04:16:03 2021-09-28 04:16:03 58 (4:02 before client disconnected) 1 30763 1 30751 0 Idle
+test kawamoto 2021-09-28 04:16:00 0 3 0 2021-09-28 04:16:03 2021-09-28 04:16:03 58 (4:02 before client disconnected) 1 30764 1 30751 1 Idle
</programlisting>
</para>
<para>
<literallayout class="monospaced">
1. connected database name
2. connected user name
- 3. process start-up timestamp (remaining time by <xref linkend="guc-client-idle-limit">. If client_idle_limit is set 0, remaining is not desplayed.)
+ 3. process start-up timestamp (If <xref linkend="guc-child-life-time"> is set not 0, the time before process restarting is displayed.)
4. process-reuse counter for <xref linkend="guc-child-max-connections">
5. protocol major version
6. protocol minor version
7. connection created timestamp
8. last client connected timestamp
- 9. client idle duration (sec) for <xref linkend="guc-client-idle-limit">
+ 9. client idle duration (sec) (If <xref linkend="guc-client-idle-limit"> is set not 0, the time before client disconnected is displayed.)
10. last client disconnected timestamp
11. connection-reuse counter
12. PostgreSQL backend process id
The <option>--verbose</option> option can help understand the output. For example:
</para>
<programlisting>
-$ pcp_proc_info -p 11001 --verbose 2871
-Database : postgres
+$ pcp_proc_info -p 11001 --verbose
+Database : test
Username : postgres
-Start time : 2021-09-07 02:12:53 (remaining: 3:36)
+Start time : 2021-09-28 04:16:00 (2:52 before process restarting)
Client connection count : 1
Major : 3
Minor : 0
-Backend connection time : 2021-09-07 02:16:59
-Client connection time : 2021-09-07 02:16:59
-Client idle duration : 84
-Client disconnection time : 2021-09-07 02:16:56
+Backend connection time : 2021-09-28 04:16:16
+Client connection time : 2021-09-28 04:16:16
+Client idle duration : 0
+Client disconnection time : 2021-09-28 04:16:33
Pool Counter : 1
-Backend PID : 3016
-Connected : 1
-PID : 2871
+Backend PID : 30795
+Connected : 0
+PID : 30750
Backend ID : 0
-Status : Idle
+Status : Wait for connection
-Database : postgres
+Database : test
Username : postgres
-Start time : 2021-09-07 02:12:53 (remaining: 3:36)
+Start time : 2021-09-28 04:16:00 (2:52 before process restarting)
Client connection count : 1
Major : 3
Minor : 0
-Backend connection time : 2021-09-07 02:16:59
-Client connection time : 2021-09-07 02:16:59
+Backend connection time : 2021-09-28 04:16:16
+Client connection time : 2021-09-28 04:16:16
Client idle duration : 0
-Client disconnection time : 2021-09-07 02:16:56
+Client disconnection time : 2021-09-28 04:16:33
+Pool Counter : 1
+Backend PID : 30796
+Connected : 0
+PID : 30750
+Backend ID : 1
+Status : Wait for connection
+
+Database : test
+Username : kawamoto
+Start time : 2021-09-28 04:16:00
+Client connection count : 0
+Major : 3
+Minor : 0
+Backend connection time : 2021-09-28 04:16:03
+Client connection time : 2021-09-28 04:16:03
+Client idle duration : 158 (2:22 before client disconnected)
+Client disconnection time :
+Pool Counter : 1
+Backend PID : 30763
+Connected : 1
+PID : 30751
+Backend ID : 0
+Status : Idle
+
+Database : test
+Username : kawamoto
+Start time : 2021-09-28 04:16:00
+Client connection count : 0
+Major : 3
+Minor : 0
+Backend connection time : 2021-09-28 04:16:03
+Client connection time : 2021-09-28 04:16:03
+Client idle duration : 158 (2:22 before client disconnected)
+Client disconnection time :
Pool Counter : 1
-Backend PID : 3017
+Backend PID : 30764
Connected : 1
-PID : 2871
+PID : 30751
Backend ID : 1
Status : Idle
</programlisting>
<itemizedlist>
<listitem>
<para>
- <literal>remaining</literal> is the remaining time by
- <xref linkend="guc-client-idle-limit">. If
- <literal>client_idle_limit</literal> is set 0,
- <literal>remaining</literal> is not desplayed.
+ If <xref linkend="guc-child-life-time"> is set not 0,
+ the time before process restarting is displayed.
</para>
</listitem>
</itemizedlist>
<para>
<literal>client_idle_duration</literal> is the time (sec) that a client
is in idle.
+ <itemizedlist>
+ <listitem>
+ <para>
+ If <xref linkend="guc-client-idle-limit"> is set not 0,
+ the time before client disconnected is displayed.
+ </para>
+ </listitem>
+ </itemizedlist>
</para>
</listitem>
It'll always return <xref linkend="guc-num-init-children"> * <xref linkend="guc-max-pool"> *
number_of_backends lines. Here is an example session:
<programlisting>
-postgres=# show pool_pools;
- pool_pid | start_time | client_connection_count | pool_id | backend_id | database | username | backend_connection_time | client_connection_time | client_disconnection_time | client_idle_duration | majorversion | minorversion | pool_counter | pool_backendpid | pool_connected | status
-----------+---------------------------------------+-------------------------+---------+------------+----------+----------+-------------------------+------------------------+---------------------------+----------------------+--------------+--------------+--------------+-----------------+----------------+---------------------
- 3727 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3727 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3727 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3727 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3727 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3727 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3727 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3727 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3728 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3728 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3728 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3728 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3728 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3728 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3728 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3728 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3729 | 2021-09-07 02:29:38 (remaining: 3:30) | 1 | 0 | 0 | postgres | postgres | 2021-09-07 02:29:47 | 2021-09-07 02:29:47 | 2021-09-07 02:29:46 | 90 | 3 | 0 | 1 | 3749 | 1 | Idle
- 3729 | 2021-09-07 02:29:38 (remaining: 3:30) | 1 | 0 | 1 | postgres | postgres | 2021-09-07 02:29:47 | 2021-09-07 02:29:47 | 2021-09-07 02:29:46 | 0 | 3 | 0 | 1 | 3750 | 1 | Idle
- 3729 | 2021-09-07 02:29:38 (remaining: 3:30) | 1 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
- 3729 | 2021-09-07 02:29:38 (remaining: 3:30) | 1 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
- 3729 | 2021-09-07 02:29:38 (remaining: 3:30) | 1 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
- 3729 | 2021-09-07 02:29:38 (remaining: 3:30) | 1 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
- 3729 | 2021-09-07 02:29:38 (remaining: 3:30) | 1 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
- 3729 | 2021-09-07 02:29:38 (remaining: 3:30) | 1 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
- 3730 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3730 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3730 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3730 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3730 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3730 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3730 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3730 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3731 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3731 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3731 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3731 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3731 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3731 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3731 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3731 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3732 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3732 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3732 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3732 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3732 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3732 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3732 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3732 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3733 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3733 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3733 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3733 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3733 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3733 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3733 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3733 | 2021-09-07 02:29:38 (remaining: 5:00) | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
- 3734 | 2021-09-07 02:29:38 (remaining: 5:00) | 4 | 0 | 0 | postgres | postgres | 2021-09-07 02:31:22 | 2021-09-07 02:31:22 | 2021-09-07 02:31:15 | 0 | 3 | 0 | 1 | 3823 | 1 | Execute command
- 3734 | 2021-09-07 02:29:38 (remaining: 5:00) | 4 | 0 | 1 | postgres | postgres | 2021-09-07 02:31:22 | 2021-09-07 02:31:22 | 2021-09-07 02:31:15 | 0 | 3 | 0 | 1 | 3824 | 1 | Execute command
- 3734 | 2021-09-07 02:29:38 (remaining: 5:00) | 4 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
- 3734 | 2021-09-07 02:29:38 (remaining: 5:00) | 4 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
- 3734 | 2021-09-07 02:29:38 (remaining: 5:00) | 4 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
- 3734 | 2021-09-07 02:29:38 (remaining: 5:00) | 4 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
- 3734 | 2021-09-07 02:29:38 (remaining: 5:00) | 4 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
- 3734 | 2021-09-07 02:29:38 (remaining: 5:00) | 4 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
+test=# show pool_pools;
+ pool_pid | start_time | client_connection_count | pool_id | backend_id | database | username | backend_connection_time | client_connection_time | client_disconnection_time | client_idle_duration | majorversion | minorversion | pool_counter | pool_backendpid | pool_connected | status
+----------+---------------------+-------------------------+---------+------------+----------+----------+-------------------------+------------------------+---------------------------+--------------------------------------+--------------+--------------+--------------+-----------------+----------------+---------------------
+ 32641 | 2021-09-28 04:40:45 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32641 | 2021-09-28 04:40:45 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32641 | 2021-09-28 04:40:45 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32641 | 2021-09-28 04:40:45 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32641 | 2021-09-28 04:40:45 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32641 | 2021-09-28 04:40:45 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32641 | 2021-09-28 04:40:45 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32641 | 2021-09-28 04:40:45 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32643 | 2021-09-28 04:40:45 | 0 | 0 | 0 | test | kawamoto | 2021-09-28 04:40:48 | 2021-09-28 04:40:48 | | 41 (4:19 before client disconnected) | 3 | 0 | 1 | 32660 | 1 | Idle
+ 32643 | 2021-09-28 04:40:45 | 0 | 0 | 1 | test | kawamoto | 2021-09-28 04:40:48 | 2021-09-28 04:40:48 | | 41 (4:19 before client disconnected) | 3 | 0 | 1 | 32661 | 1 | Idle
+ 32643 | 2021-09-28 04:40:45 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
+ 32643 | 2021-09-28 04:40:45 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
+ 32643 | 2021-09-28 04:40:45 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
+ 32643 | 2021-09-28 04:40:45 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
+ 32643 | 2021-09-28 04:40:45 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
+ 32643 | 2021-09-28 04:40:45 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Idle
+ 32644 | 2021-09-28 04:40:45 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32644 | 2021-09-28 04:40:45 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32644 | 2021-09-28 04:40:45 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32644 | 2021-09-28 04:40:45 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32644 | 2021-09-28 04:40:45 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32644 | 2021-09-28 04:40:45 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32644 | 2021-09-28 04:40:45 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32644 | 2021-09-28 04:40:45 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32645 | 2021-09-28 04:40:45 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32645 | 2021-09-28 04:40:45 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32645 | 2021-09-28 04:40:45 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32645 | 2021-09-28 04:40:45 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32645 | 2021-09-28 04:40:45 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32645 | 2021-09-28 04:40:45 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32645 | 2021-09-28 04:40:45 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32645 | 2021-09-28 04:40:45 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | 0 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | 0 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | 1 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | 1 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Wait for connection
+ 32648 | 2021-09-28 04:40:45 | 1 | 0 | 0 | test | postgres | 2021-09-28 04:40:52 | 2021-09-28 04:40:52 | 2021-09-28 04:40:59 | 0 | 3 | 0 | 1 | 32681 | 0 | Execute command
+ 32648 | 2021-09-28 04:40:45 | 1 | 0 | 1 | test | postgres | 2021-09-28 04:40:52 | 2021-09-28 04:40:52 | 2021-09-28 04:40:59 | 0 | 3 | 0 | 1 | 32682 | 0 | Execute command
+ 32648 | 2021-09-28 04:40:45 | 1 | 1 | 0 | test | kawamoto | 2021-09-28 04:41:30 | 2021-09-28 04:41:30 | | 0 (5:00 before client disconnected) | 3 | 0 | 1 | 32746 | 1 | Execute command
+ 32648 | 2021-09-28 04:40:45 | 1 | 1 | 1 | test | kawamoto | 2021-09-28 04:41:30 | 2021-09-28 04:41:30 | | 0 (5:00 before client disconnected) | 3 | 0 | 1 | 32747 | 1 | Execute command
+ 32648 | 2021-09-28 04:40:45 | 1 | 2 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
+ 32648 | 2021-09-28 04:40:45 | 1 | 2 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
+ 32648 | 2021-09-28 04:40:45 | 1 | 3 | 0 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
+ 32648 | 2021-09-28 04:40:45 | 1 | 3 | 1 | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | Execute command
(64 rows)
</programlisting>
<itemizedlist>
<listitem>
<para>
- <literal>remaining</literal> is the remaining time by
- <xref linkend="guc-client-idle-limit">. If
- <literal>client_idle_limit</literal> is set 0,
- <literal>remaining</literal> is not desplayed.
+ If <xref linkend="guc-child-life-time"> is set not 0,
+ the time before process restarting is displayed.
</para>
</listitem>
</itemizedlist>
<para>
Here is an example session:
<programlisting>
-postgres=# show pool_processes;
- pool_pid | start_time | client_connection_count | database | username | backend_connection_time | pool_counter | status
-----------+---------------------------------------+-------------------------+----------+----------+-------------------------+--------------+---------------------
- 6685 | 2021-09-07 02:41:13 (remaining: 5:00) | 0 | | | | | Wait for connection
- 6686 | 2021-09-07 02:41:13 (remaining: 5:00) | 0 | | | | | Wait for connection
- 6687 | 2021-09-07 02:41:13 (remaining: 5:00) | 0 | | | | | Wait for connection
- 6688 | 2021-09-07 02:41:13 (remaining: 4:10) | 1 | postgres | postgres | 2021-09-07 02:41:48 | 1 | Idle
- 6689 | 2021-09-07 02:41:13 (remaining: 5:00) | 0 | | | | | Wait for connection
- 6690 | 2021-09-07 02:41:13 (remaining: 5:00) | 0 | | | | | Wait for connection
- 6691 | 2021-09-07 02:41:13 (remaining: 5:00) | 0 | | | | | Wait for connection
- 6692 | 2021-09-07 02:41:13 (remaining: 5:00) | 2 | postgres | postgres | 2021-09-07 02:42:38 | 1 | Execute command
+test=# show pool_processes;
+ pool_pid | start_time | client_connection_count | database | username | backend_connection_time | pool_counter | status
+----------+------------------------------------------------------+-------------------------+----------+----------+-------------------------+--------------+---------------------
+ 32641 | 2021-09-28 04:40:45 | 0 | | | | | Wait for connection
+ 32642 | 2021-09-28 04:40:45 | 0 | | | | | Wait for connection
+ 32643 | 2021-09-28 04:40:45 | 0 | test | kawamoto | 2021-09-28 04:40:48 | 1 | Idle
+ 32644 | 2021-09-28 04:40:45 | 0 | test | kawamoto | 2021-09-28 04:43:15 | 1 | Execute command
+ 32645 | 2021-09-28 04:40:45 | 0 | | | | | Wait for connection
+ 32646 | 2021-09-28 04:40:45 | 0 | | | | | Wait for connection
+ 32647 | 2021-09-28 04:40:45 | 0 | | | | | Wait for connection
+ 32648 | 2021-09-28 04:40:45 (3:15 before process restarting) | 2 | | | | | Wait for connection
(8 rows)
</programlisting>
</para>
{
pid_t pid; /* OS's process id */
time_t start_time; /* fork() time */
+ char connected; /* if not 0 this process is already used*/
+ int wait_for_connect; /* waiting time for client connection (s) */
ConnectionInfo *connection_info; /* head of the connection info for
* this process */
int client_connection_count; /* how many times clients used this process */
char backend_connection_time[POOLCONFIG_MAXDATELEN + 1];
char client_connection_time[POOLCONFIG_MAXDATELEN + 1];
char client_disconnection_time[POOLCONFIG_MAXDATELEN + 1];
- char client_idle_duration[POOLCONFIG_MAXCOUNTLEN + 1];
+ char client_idle_duration[POOLCONFIG_MAXDATELEN + 1];
char pool_majorversion[POOLCONFIG_MAXCOUNTLEN + 1];
char pool_minorversion[POOLCONFIG_MAXCOUNTLEN + 1];
char pool_counter[POOLCONFIG_MAXCOUNTLEN + 1];
process_info[i].start_time = time(NULL);
process_info[i].client_connection_count = 0;
process_info[i].status = WAIT_FOR_CONNECT;
+ process_info[i].connected = 0;
+ process_info[i].wait_for_connect = 0;
}
/* create pipe for delivering event */
process_info[i].start_time = time(NULL);
process_info[i].client_connection_count = 0;
process_info[i].status = WAIT_FOR_CONNECT;
+ process_info[i].connected = 0;
+ process_info[i].wait_for_connect = 0;
}
}
else
new_pid = process_info[i].pid;
process_info[i].client_connection_count = 0;
process_info[i].status = WAIT_FOR_CONNECT;
+ process_info[i].connected = 0;
+ process_info[i].wait_for_connect = 0;
}
else
process_info[i].pid = 0;
process_info[i].start_time = time(NULL);
process_info[i].client_connection_count = 0;
process_info[i].status = WAIT_FOR_CONNECT;
+ process_info[i].connected = 0;
+ process_info[i].wait_for_connect = 0;
}
}
else
static void check_restart_request(void);
static void enable_authentication_timeout(void);
static void disable_authentication_timeout(void);
-static int wait_for_new_connections(int *fds, struct timeval *timeout, SockAddr *saddr);
+static int wait_for_new_connections(int *fds, SockAddr *saddr);
static void check_config_reload(void);
static void get_backends_status(unsigned int *valid_backends, unsigned int *down_backends);
static void validate_backend_connectivity(int front_end_fd);
POOL_CONNECTION_POOL *volatile backend = NULL;
struct timeval now;
struct timezone tz;
- struct timeval timeout;
- static int connected = 0; /* non 0 if has been accepted connections from
- * frontend */
/* counter for child_max_connections. "volatile" declaration is necessary
* so that this is counted up even if long jump is issued due to
/* We can now handle ereport(ERROR) */
PG_exception_stack = &local_sigjmp_buf;
- timeout.tv_sec = pool_config->child_life_time;
- timeout.tv_usec = 0;
-
for (;;)
{
StartupPacket *sp;
/* Destroy session context for just in case... */
pool_session_context_destroy();
- front_end_fd = wait_for_new_connections(fds, &timeout, &saddr);
+ front_end_fd = wait_for_new_connections(fds, &saddr);
+ proc_info->wait_for_connect = 0;
if (front_end_fd == OPERATION_TIMEOUT)
{
- if (pool_config->child_life_time > 0 && connected)
+ if (pool_config->child_life_time > 0 && proc_info->connected)
{
ereport(DEBUG1,
(errmsg("child life %d seconds expired", pool_config->child_life_time)));
child_frontend = NULL;
continue;
}
- connected = 1;
+ proc_info->connected = 1;
/*
* show ps status
if (pool_config->log_disconnections)
log_disconnections(sp->database, sp->user);
- timeout.tv_sec = pool_config->child_life_time;
- timeout.tv_usec = 0;
-
/* increment queries counter if necessary */
if (pool_config->child_max_connections > 0)
connections_count++;
*/
static int
-wait_for_new_connections(int *fds, struct timeval *timeout, SockAddr *saddr)
+wait_for_new_connections(int *fds, SockAddr *saddr)
{
fd_set rmask;
int numfds;
static int cnt;
#endif
- struct timeval *timeoutval;
- struct timeval tv1,
- tv2,
- tmback = {0, 0};
+ struct timeval *timeout;
+ struct timeval timeoutdata;
+
+ ProcessInfo* proc_info = pool_get_process_info(getpid());
for (walk = fds; *walk != -1; walk++)
socket_set_nonblock(*walk);
set_process_status(WAIT_FOR_CONNECT);
- memcpy((char *) &rmask, (char *) &readmask, sizeof(fd_set));
-
- if (timeout->tv_sec == 0 && timeout->tv_usec == 0)
- timeoutval = NULL;
- else
- {
- timeoutval = timeout;
- tmback.tv_sec = timeout->tv_sec;
- tmback.tv_usec = timeout->tv_usec;
- gettimeofday(&tv1, NULL);
-
-#ifdef DEBUG
- ereport(DEBUG3,
- (errmsg("before select = {%d, %d}", timeoutval->tv_sec, timeoutval->tv_usec)));
- ereport(DEBUG3,
- (errmsg("g:before select = {%d, %d}", tv1.tv_sec, tv1.tv_usec)));
-#endif
- }
-
/*
* If child life time is disabled and serialize_accept is on, we serialize
* select() and accept() to avoid the "Thundering herd" problem.
}
set_ps_display("wait for connection request", false);
- set_process_status(WAIT_FOR_CONNECT);
ereport(DEBUG1,
(errmsg("LOCKING select()")));
}
- numfds = select(nsocks, &rmask, NULL, NULL, timeoutval);
+ for (;;)
+ {
+ /* check backend timer is expired */
+ if (backend_timer_expired)
+ {
+ pool_backend_timer();
+ backend_timer_expired = 0;
+ }
+
+ /* prepare select */
+ memcpy((char *) &rmask, (char *) &readmask, sizeof(fd_set));
+ if (pool_config->child_life_time > 0)
+ {
+ timeoutdata.tv_sec = 1;
+ timeoutdata.tv_usec = 0;
+ timeout = &timeoutdata;
+ }
+ else
+ {
+ timeout = NULL;
+ }
+
+ numfds = select(nsocks, &rmask, NULL, NULL, timeout);
+
+ /* not timeout*/
+ if (numfds != 0)
+ break;
+
+ /* timeout */
+ proc_info->wait_for_connect++;
+
+ if (proc_info->wait_for_connect > pool_config->child_life_time)
+ return OPERATION_TIMEOUT;
+
+ }
save_errno = errno;
backend_timer_expired = 0;
}
- /*
- * following code fragment computes remaining timeout val in a portable
- * way. Linux does this automatically but other platforms do not.
- */
- if (timeoutval)
- {
- gettimeofday(&tv2, NULL);
-
- tmback.tv_usec -= tv2.tv_usec - tv1.tv_usec;
- tmback.tv_sec -= tv2.tv_sec - tv1.tv_sec;
-
- if (tmback.tv_usec < 0)
- {
- tmback.tv_sec--;
- if (tmback.tv_sec < 0)
- {
- timeout->tv_sec = 0;
- timeout->tv_usec = 0;
- }
- else
- {
- tmback.tv_usec += 1000000;
- timeout->tv_sec = tmback.tv_sec;
- timeout->tv_usec = tmback.tv_usec;
- }
- }
-#ifdef DEBUG
- ereport(DEBUG3,
- (errmsg("g:after select = {%d, %d}", tv2.tv_sec, tv2.tv_usec)));
- ereport(DEBUG3,
- (errmsg("after select = {%d, %d}", timeout->tv_sec, timeout->tv_usec)));
-#endif
- }
-
errno = save_errno;
if (numfds == -1)
errdetail("select on socket failed with error : \"%m\"")));
}
- /* timeout */
- if (numfds == 0)
- {
- return OPERATION_TIMEOUT;
- }
-
for (walk = fds; *walk != -1; walk++)
{
if (FD_ISSET(*walk, &rmask))
proc_id = process_info[child].pid;
pi = pool_get_process_info(proc_id);
- int remaining_time = pool_config->client_idle_limit;
- if (pool_config->client_idle_limit)
+ int exist_live_connection = 0;
+ for (pool = 0; pool < pool_config->max_pool; pool++)
{
- for (pool = 0; pool < pool_config->max_pool; pool++)
+ poolBE = pool * MAX_NUM_BACKENDS;
+ if (pi->connection_info[poolBE].connected)
{
- for (backend_id = 0; backend_id < NUM_BACKENDS; backend_id++)
- {
- poolBE = pool * MAX_NUM_BACKENDS + backend_id;
- if (pi->connection_info[poolBE].client_idle_duration > 0)
- remaining_time = pool_config->client_idle_limit - pi->connection_info[poolBE].client_idle_duration;
- }
+ exist_live_connection = 1;
+ break;
}
}
+
for (pool = 0; pool < pool_config->max_pool; pool++)
{
+ int idle_duration = pi->connection_info[pool * MAX_NUM_BACKENDS].client_idle_duration;
+ int cliet_idle_time = pool_config->client_idle_limit;
+ if (pool_config->client_idle_limit > 0)
+ {
+ cliet_idle_time = pool_config->client_idle_limit - idle_duration;
+ }
+
for (backend_id = 0; backend_id < NUM_BACKENDS; backend_id++)
{
poolBE = pool * MAX_NUM_BACKENDS + backend_id;
if (pi->start_time)
{
- if (pool_config->client_idle_limit)
+ if ((pool_config->child_life_time > 0)
+ && (pi->connected)
+ && (!exist_live_connection))
{
char proc_start_time[POOLCONFIG_MAXDATELEN + 1];
+ int wait_for_connect_time = pool_config->child_life_time - pi->wait_for_connect;
+
strftime(proc_start_time, sizeof(proc_start_time),
"%Y-%m-%d %H:%M:%S", localtime(&pi->start_time));
snprintf(pools[lines].process_start_time, sizeof(pools[lines].process_start_time),
- "%s (remaining: %d:%02d)", proc_start_time,
- remaining_time / 60,
- remaining_time % 60);
+ "%s (%d:%02d before process restarting)", proc_start_time,
+ wait_for_connect_time / 60,
+ wait_for_connect_time % 60);
}
else
{
snprintf(pools[lines].client_connection_count, sizeof(pools[lines].client_connection_count),
"%d", pi->client_connection_count);
- if (pi->connection_info[poolBE].client_connection_time == 0){
+ if (pi->connection_info[poolBE].client_connection_time == 0)
+ {
*(pools[lines].client_connection_time) = '\0';
}
else
"%Y-%m-%d %H:%M:%S", localtime(&pi->connection_info[poolBE].client_connection_time));
}
- if (pi->connection_info[poolBE].client_disconnection_time == 0){
+ if (pi->connection_info[poolBE].client_disconnection_time == 0)
+ {
*(pools[lines].client_disconnection_time) = '\0';
}
else
"%Y-%m-%d %H:%M:%S", localtime(&pi->connection_info[poolBE].client_disconnection_time));
}
- snprintf(pools[lines].client_idle_duration, sizeof(pools[lines].client_idle_duration), "%d",
- pi->connection_info[poolBE].client_idle_duration);
+ if ((pool_config->client_idle_limit > 0)
+ && (pi->connection_info[poolBE].connected))
+ {
+ snprintf(pools[lines].client_idle_duration, sizeof(pools[lines].client_idle_duration),
+ "%d (%d:%02d before client disconnected)", idle_duration,
+ cliet_idle_time / 60,
+ cliet_idle_time % 60);
+ }
+ else
+ snprintf(pools[lines].client_idle_duration, sizeof(pools[lines].client_idle_duration),
+ "%d", idle_duration);
if (strlen(pi->connection_info[poolBE].database) == 0)
{
proc_id = process_info[child].pid;
pi = pool_get_process_info(proc_id);
- int remaining_time = pool_config->client_idle_limit;
- if (pool_config->client_idle_limit)
+ int exist_live_connection = 0;
+ for (pool = 0; pool < pool_config->max_pool; pool++)
{
- int backend_id;
- for (pool = 0; pool < pool_config->max_pool; pool++)
+ poolBE = pool * MAX_NUM_BACKENDS;
+ if (pi->connection_info[poolBE].connected)
{
- for (backend_id = 0; backend_id < NUM_BACKENDS; backend_id++)
- {
- poolBE = pool * MAX_NUM_BACKENDS + backend_id;
- if (pi->connection_info[poolBE].client_idle_duration > 0)
- remaining_time = pool_config->client_idle_limit - pi->connection_info[poolBE].client_idle_duration;
- }
+ exist_live_connection = 1;
+ break;
}
}
snprintf(processes[child].pool_pid, POOLCONFIG_MAXCOUNTLEN, "%d", proc_id);
- if (pool_config->client_idle_limit)
+ if ((pool_config->child_life_time > 0)
+ && (pi->connected)
+ && (!exist_live_connection))
{
char proc_start_time[POOLCONFIG_MAXDATELEN + 1];
+ int wait_for_connect_time = pool_config->child_life_time - pi->wait_for_connect;
+
strftime(proc_start_time, sizeof(proc_start_time),
"%Y-%m-%d %H:%M:%S", localtime(&pi->start_time));
snprintf(processes[child].process_start_time, sizeof(processes[child].process_start_time),
- "%s (remaining: %d:%02d)", proc_start_time,
- remaining_time / 60,
- remaining_time % 60);
+ "%s (%d:%02d before process restarting)", proc_start_time,
+ wait_for_connect_time / 60,
+ wait_for_connect_time % 60);
}
else
{