From: Tatsuo Ishii Date: Mon, 9 Jul 2018 08:14:37 +0000 (+0900) Subject: Allow to display Pgpool-II child process id and PostgreSQL backend id in pcp_proc_info. X-Git-Tag: V4_0_0_ALPHA1~46 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=62bd2965ed0dc8ec03d608a51ac019254df49927;p=pgpool2.git Allow to display Pgpool-II child process id and PostgreSQL backend id in pcp_proc_info. 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. --- diff --git a/doc.ja/src/sgml/ref/pcp_proc_info.sgml b/doc.ja/src/sgml/ref/pcp_proc_info.sgml index 373023f49..82224db26 100644 --- a/doc.ja/src/sgml/ref/pcp_proc_info.sgml +++ b/doc.ja/src/sgml/ref/pcp_proc_info.sgml @@ -53,6 +53,19 @@ Pgpool-II documentation + + + + + + +すべての子プロセスと、それに関するコネクションスロットを表示します。 + + + + @@ -81,6 +94,16 @@ Pgpool-II documentation + +もし-aオプションも-Pオプションも指定されない場合は、すべての接続されたPgpool-II子プロセスが表示されます。 +この場合、接続された子プロセスが存在しない場合は、"No process information available"メッセージだけが表示されます。 @@ -95,9 +118,9 @@ Pgpool-II documentation --> 例を示します。 -$ 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 @@ -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 @@ -143,25 +170,29 @@ 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 --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 diff --git a/doc/src/sgml/ref/pcp_proc_info.sgml b/doc/src/sgml/ref/pcp_proc_info.sgml index e8fd8027e..1365142fd 100644 --- a/doc/src/sgml/ref/pcp_proc_info.sgml +++ b/doc/src/sgml/ref/pcp_proc_info.sgml @@ -24,7 +24,7 @@ Pgpool-II documentation pcp_proc_info options - processid + pgpool_child_processid @@ -41,12 +41,22 @@ Pgpool-II documentation + + + + + + Display all child processes and their available connection slots. + + + + - PID of Pgpool-II child process. + PID of Pgpool-II child process. @@ -60,7 +70,14 @@ Pgpool-II documentation - + + If -a nor -P is not specified, process information of all + connected Pgpool-II child process will + be printed. In this case if there's no + connected Pgpool-II child process, + nothing but "No process information available" message will be + printed. + @@ -68,9 +85,9 @@ Pgpool-II documentation Here is an example output: -$ 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 @@ -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 @@ -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 can help understand the output. For example: -$ 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 diff --git a/src/tools/pcp/pcp_frontend_client.c b/src/tools/pcp/pcp_frontend_client.c index 9fbc16d73..a55a292fe 100644 --- a/src/tools/pcp/pcp_frontend_client.c +++ b/src/tools/pcp/pcp_frontend_client.c @@ -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++)