Allow to display Pgpool-II child process id and PostgreSQL backend id in pcp_proc_info.
authorTatsuo Ishii <ishii@postgresql.org>
Mon, 9 Jul 2018 08:14:37 +0000 (17:14 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Mon, 9 Jul 2018 08:14:37 +0000 (17:14 +0900)
If --all option was not specified, Pgpool-II child process id was not
displayed. This is not reasonable since if Pgpool-II child process id
is not given, multiple entries of Pgpool-II child process are
displayed without no information to distinguish them.

So fix the command so that it always display Pgpool-II child process
id. Also there's no reason not to display PostgreSQL backend id, so
displays it.

doc.ja/src/sgml/ref/pcp_proc_info.sgml
doc/src/sgml/ref/pcp_proc_info.sgml
src/tools/pcp/pcp_frontend_client.c

index 373023f49e2385bc10d485e3682d972e55a9e223..82224db26ccfc8dcb598fc6b831b0736728ba363 100644 (file)
@@ -53,6 +53,19 @@ Pgpool-II documentation
    <para>
     <variablelist>
 
+     <varlistentry>
+      <term><option>-a</option></term>
+      <term><option>--all</option></term>
+      <listitem>
+       <para>
+<!--
+        Display all child processes and their available connection slots.
+-->
+すべての子プロセスと、それに関するコネクションスロットを表示します。
+       </para>
+      </listitem>
+     </varlistentry>
+
      <varlistentry>
       <term><option>-P <replaceable class="parameter">PID</replaceable></option></term>
       <term><option>--process-id=<replaceable class="parameter">PID</replaceable></option></term>
@@ -81,6 +94,16 @@ Pgpool-II documentation
       </listitem>
      </varlistentry>
     </variablelist>
+<!--
+    If -a nor -P is not specified, process information of all
+    connected <productname>Pgpool-II</productname> child process will
+    be printed. In this case if there's no
+    connected <productname>Pgpool-II</productname> child process,
+    nothing but "No process information available" message will be
+    printed.
+-->
+もし-aオプションも-Pオプションも指定されない場合は、すべての接続された<productname>Pgpool-II</productname>子プロセスが表示されます。
+この場合、接続された子プロセスが存在しない場合は、"No process information available"メッセージだけが表示されます。
    </para>
  </refsect1>
 
@@ -95,9 +118,9 @@ Pgpool-II documentation
     -->
     例を示します。
     <programlisting>
-$ pcp_proc_info -p 11001
-test t-ishii 2018-05-09 11:10:16 2018-05-09 11:10:40 3 0 1 4157 1
-test t-ishii 2018-05-09 11:10:16 2018-05-09 11:10:40 3 0 1 4158 1
+$ pcp_proc_info -p 11001 1406
+test t-ishii 2018-07-09 16:43:53 2018-07-09 16:44:08 3 0 1 1435 1 1406 0
+test t-ishii 2018-07-09 16:43:53 2018-07-09 16:44:08 3 0 1 1436 1 1406 1
     </programlisting>
   </para>
   <para>
@@ -116,6 +139,8 @@ test t-ishii 2018-05-09 11:10:16 2018-05-09 11:10:40 3 0 1 4158 1
 7. connection-reuse counter
 8. PostgreSQL backend process id
 9. 1 if frontend conncted 0 if not
+10. pgpool child process id
+11. PostgreSQL backend id 
 -->
 1. 接続先のデータベース名
 2. 接続先のユーザ名
@@ -126,6 +151,8 @@ test t-ishii 2018-05-09 11:10:16 2018-05-09 11:10:40 3 0 1 4158 1
 7. 接続の再利用カウンタ値
 8. PostgreSQLバックエンドプロセスのプロセスID
 9. フロントエンドが接続中なら1、そうでなければ0
+10. pgpool子プロセスID
+11. PostgreSQLバックエンドID
 </literallayout>
   </para>
   <para>
@@ -143,25 +170,29 @@ test t-ishii 2018-05-09 11:10:16 2018-05-09 11:10:40 3 0 1 4158 1
     <option>--verbose</option> オプションは出力内容を理解するのに役に立ちます。例:
   </para>
     <programlisting>
-$ pcp_proc_info -p 11001 --verbose
+$ pcp_proc_info -p 11001 --verbose 1406
 Database     : test
 Username     : t-ishii
-Start time   : 2018-05-09 11:10:16
-Creation time: 2018-05-09 11:10:40
+Start time   : 2018-07-09 16:43:53
+Creation time: 2018-07-09 16:44:08
 Major        : 3
 Minor        : 0
 Counter      : 1
-Backend PID  : 4157
+Backend PID  : 1435
 Connected    : 1
+PID          : 1406
+Backend ID   : 0
 Database     : test
 Username     : t-ishii
-Start time   : 2018-05-09 11:10:16
-Creation time: 2018-05-09 11:10:40
+Start time   : 2018-07-09 16:43:53
+Creation time: 2018-07-09 16:44:08
 Major        : 3
 Minor        : 0
 Counter      : 1
-Backend PID  : 4158
+Backend PID  : 1436
 Connected    : 1
+PID          : 1406
+Backend ID   : 1
     </programlisting>
  </refsect1>
 
index e8fd8027e399bcaf65605802082c37e195d7ac97..1365142fd5f3f3722af68d668e4d6bfb2b90fe86 100644 (file)
@@ -24,7 +24,7 @@ Pgpool-II documentation
   <cmdsynopsis>
    <command>pcp_proc_info</command>
    <arg rep="repeat"><replaceable>options</replaceable></arg>
-   <arg><replaceable>processid</replaceable></arg>
+   <arg><replaceable>pgpool_child_processid</replaceable></arg>
   </cmdsynopsis>
  </refsynopsisdiv>
 
@@ -41,12 +41,22 @@ Pgpool-II documentation
    <para>
     <variablelist>
 
+     <varlistentry>
+      <term><option>-a</option></term>
+      <term><option>--all</option></term>
+      <listitem>
+       <para>
+        Display all child processes and their available connection slots.
+       </para>
+      </listitem>
+     </varlistentry>
+
      <varlistentry>
       <term><option>-P <replaceable class="parameter">PID</replaceable></option></term>
       <term><option>--process-id=<replaceable class="parameter">PID</replaceable></option></term>
       <listitem>
        <para>
-          PID of Pgpool-II child process.
+          PID of <productname>Pgpool-II</productname> child process.
        </para>
       </listitem>
      </varlistentry>
@@ -60,7 +70,14 @@ Pgpool-II documentation
       </listitem>
      </varlistentry>
     </variablelist>
-   </para>
+
+    If -a nor -P is not specified, process information of all
+    connected <productname>Pgpool-II</productname> child process will
+    be printed. In this case if there's no
+    connected <productname>Pgpool-II</productname> child process,
+    nothing but "No process information available" message will be
+    printed.
+    </para>
  </refsect1>
 
  <refsect1>
@@ -68,9 +85,9 @@ Pgpool-II documentation
    <para>
        Here is an example output:
     <programlisting>
-$ pcp_proc_info -p 11001
-test t-ishii 2018-05-09 11:10:16 2018-05-09 11:10:40 3 0 1 4157 1
-test t-ishii 2018-05-09 11:10:16 2018-05-09 11:10:40 3 0 1 4158 1
+$ pcp_proc_info -p 11001 1406
+test t-ishii 2018-07-09 16:43:53 2018-07-09 16:44:08 3 0 1 1435 1 1406 0
+test t-ishii 2018-07-09 16:43:53 2018-07-09 16:44:08 3 0 1 1436 1 1406 1
     </programlisting>
   </para>
   <para>
@@ -85,6 +102,8 @@ test t-ishii 2018-05-09 11:10:16 2018-05-09 11:10:40 3 0 1 4158 1
 7. connection-reuse counter
 8. PostgreSQL backend process id
 9. 1 if frontend conncted 0 if not
+10. pgpool child process id
+11. PostgreSQL backend id 
 </literallayout>
   </para>
   <para>
@@ -95,25 +114,29 @@ test t-ishii 2018-05-09 11:10:16 2018-05-09 11:10:40 3 0 1 4158 1
        The <option>--verbose</option> option can help understand the output. For example:
   </para>
     <programlisting>
-$ pcp_proc_info -p 11001 --verbose
+$ pcp_proc_info -p 11001 --verbose 1406
 Database     : test
 Username     : t-ishii
-Start time   : 2018-05-09 11:10:16
-Creation time: 2018-05-09 11:10:40
+Start time   : 2018-07-09 16:43:53
+Creation time: 2018-07-09 16:44:08
 Major        : 3
 Minor        : 0
 Counter      : 1
-Backend PID  : 4157
+Backend PID  : 1435
 Connected    : 1
+PID          : 1406
+Backend ID   : 0
 Database     : test
 Username     : t-ishii
-Start time   : 2018-05-09 11:10:16
-Creation time: 2018-05-09 11:10:40
+Start time   : 2018-07-09 16:43:53
+Creation time: 2018-07-09 16:44:08
 Major        : 3
 Minor        : 0
 Counter      : 1
-Backend PID  : 4158
+Backend PID  : 1436
 Connected    : 1
+PID          : 1406
+Backend ID   : 1
     </programlisting>
  </refsect1>
 
index 9fbc16d73c3af0f49afb5da0b3de3e07361998e2..a55a292fec1c012918f9d82186e91ae8be257dfb 100644 (file)
@@ -560,8 +560,7 @@ output_procinfo_result(PCPResultInfo* pcpResInfo, bool all, bool verbose)
        int array_size = pcp_result_slot_count(pcpResInfo);
        if (verbose)
        {
-               if (all)
-                       frmt =  "Database     : %s\n"
+               frmt =  "Database     : %s\n"
                        "Username     : %s\n"
                        "Start time   : %s\n"
                        "Creation time: %s\n"
@@ -572,23 +571,10 @@ output_procinfo_result(PCPResultInfo* pcpResInfo, bool all, bool verbose)
                        "Connected    : %d\n"
                        "PID          : %d\n"
                        "Backend ID   : %d\n";
-               else
-                       frmt =  "Database     : %s\n"
-                       "Username     : %s\n"
-                       "Start time   : %s\n"
-                       "Creation time: %s\n"
-                       "Major        : %d\n"
-                       "Minor        : %d\n"
-                       "Counter      : %d\n"
-                       "Backend PID  : %d\n"
-                       "Connected    : %d\n";
        }
        else
        {
-               if (all)
-                       frmt = "%s %s %s %s %d %d %d %d %d %d %d\n";
-               else
-                       frmt = "%s %s %s %s %d %d %d %d %d\n";
+               frmt = "%s %s %s %s %d %d %d %d %d %d %d\n";
        }
 
        for (i = 0; i < array_size; i++)