<listitem>
<para>
<!--
- Similar to <xref linkend="guc-log-statement">, except that it print the
+ Similar to <xref linkend="guc-log-statement">, except that it prints the
logs for each DB node separately. It can be useful to make sure that
replication or load-balancing is working.
-->
</listitem>
</varlistentry>
+ <varlistentry id="guc-notice-per-node-statement" xreflabel="notice_per_node_statement">
+ <term><varname>notice_per_node_statement</varname> (<type>boolean</type>)
+ <indexterm>
+ <!--
+ <primary><varname>notice_per_node_statement</varname> configuration parameter</primary>
+ -->
+ <primary><varname>notice_per_node_statement</varname> 設定パラメータ</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ <!--
+ Similar to <xref linkend="guc-log-per-node-statement">, except
+ that it prints the statement logs for each DB node separately as
+ a NOTICE message. With the
+ default <xref linkend="client_min_messages"> setting (that is
+ NOTICE), the log message will be printed on client's terminal as
+ well. This is convenient for clients because it does not need to
+ access <productname>Pgpool-II</productname> log file. Note that
+ unlike <xref linkend="guc-log-per-node-statement">, <xref linkend="guc-notice-per-node-statement">
+ does not print internal queries, (e.g., system catalog inquiry).
+ This is because this feature is designed to be used for testing
+ as well. As internal queries tend to be non-deterministic,
+ printing them in testing is not helpful. For the same reason,
+ backend process id is not printed.
+ -->
+ <xref linkend="guc-log-per-node-statement">と似ていますが、NOTICEメッセージとしてDBノード単位でログが出力されます。
+ <xref linkend="guc-client-min-messages">のデフォルト設定(すなわちNOTICE)では、このログメッセージはクライアントの端末にも出力されます。
+ クライアントにとっては、<productname>Pgpool-II</productname>のログファイルにアクセスする必要がないので便利です。
+ <xref linkend="guc-log-per-node-statement">と違って、<xref linkend="guc-notice-per-node-statement">は内部的に発行する問い合わせ(たとえば
+システムカタログへの問い合わせ)は出力しないことに注意してください。
+ これは、この機能がテストにも使えるように設計されているからです。
+ 内部的な問い合わせは非決定論的に発行される傾向があるため、テストに使うには適していません。
+ 同じ理由で、バックエンドのプロセスIDも出力されません。
+ </para>
+ <para>
+ <!--
+ This parameter can be changed by reloading the <productname>Pgpool-II</> configurations.
+ You can also use <xref linkend="SQL-PGPOOL-SET"> command to alter the value of
+ this parameter for a current session.
+ -->
+ このパラメータは<productname>Pgpool-II</>の設定を再読み込みすることで変更可能です。
+ 現在のセッションでのパラメータ値は、<xref linkend="SQL-PGPOOL-SET">コマンドで変更することもできます。
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry id="guc-log-client-messages" xreflabel="log_client_messages">
<term><varname>log_client_messages</varname> (<type>boolean</type>)
<indexterm>
</listitem>
</varlistentry>
+ <varlistentry id="guc-notice-per-node-statement" xreflabel="notice_per_node_statement">
+ <term><varname>notice_per_node_statement</varname> (<type>boolean</type>)
+ <indexterm>
+ <primary><varname>notice_per_node_statement</varname> configuration parameter</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ Similar to <xref linkend="guc-log-per-node-statement">, except
+ that it prints the statement logs for each DB node separately as
+ a NOTICE message. With the
+ default <xref linkend="guc-client-min-messages"> setting (that
+ is NOTICE), the log message will be printed on client's terminal
+ as well. This is convenient for clients because it does not need
+ to access <productname>Pgpool-II</productname> log file. Note
+ that
+ unlike <xref linkend="guc-log-per-node-statement">, <xref linkend="guc-notice-per-node-statement">
+ does not print internal queries, (e.g., system catalog inquiry).
+ This is because this feature is designed to be used for testing
+ as well. As internal queries tend to be non-deterministic,
+ printing them in testing is not helpful. For the same reason,
+ backend process id is not printed.
+ </para>
+ <para>
+ This parameter can be changed by reloading the <productname>Pgpool-II</> configurations.
+ You can also use <xref linkend="SQL-PGPOOL-SET"> command to alter the value of
+ this parameter for a current session.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry id="guc-log-client-messages" xreflabel="log_client_messages">
<term><varname>log_client_messages</varname> (<type>boolean</type>)
<indexterm>
NULL, NULL, NULL
},
+ {
+ {"notice_per_node_statement", CFGCXT_SESSION, LOGGING_CONFIG,
+ "Logs notice message for per node detailed SQL statements.",
+ CONFIG_VAR_TYPE_ENUM, false, 0
+ },
+ &g_pool_config.notice_per_node_statement,
+ false,
+ NULL, NULL, NULL
+ },
+
{
{"log_client_messages", CFGCXT_SESSION, LOGGING_CONFIG,
"Logs any client messages in the pgpool logs.",
}
per_node_statement_log(backend, i, string);
+ per_node_statement_notice(backend, i, string);
stat_count_up(i, query_context->parse_tree);
send_simplequery_message(CONNECTION(backend, i), len, string, MAJOR(backend));
}
}
per_node_statement_log(backend, i, msgbuf);
+ per_node_statement_notice(backend, i, msgbuf);
}
/* if Execute message, count up stats count */
* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Copyright (c) 2003-2022 PgPool Global Development Group
+ * Copyright (c) 2003-2023 PgPool Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
bool log_statement; /* logs all SQL statements */
bool log_per_node_statement; /* logs per node detailed SQL
* statements */
+ bool notice_per_node_statement; /* logs notice message for per node detailed SQL
+ * statements */
bool log_client_messages; /* If true, logs any client messages */
char *lobj_lock_table; /* table name to lock for rewriting
* lo_creat */
* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Copyright (c) 2003-2022 PgPool Global Development Group
+ * Copyright (c) 2003-2023 PgPool Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
extern void pool_emit_log_for_message_length_diff(int *length_array, char *name);
+extern void per_node_statement_notice(POOL_CONNECTION_POOL * backend, int node_id, char *query);
+
/*
* modules defined in pool_proto2.c
*/
* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Copyright (c) 2003-2022 PgPool Global Development Group
+ * Copyright (c) 2003-2023 PgPool Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
(errmsg("DB node id: %d backend pid: %d statement: %s", node_id, ntohl(slot->pid), query)));
}
+/*
+ * Make per DB node statement notice message
+ */
+void
+per_node_statement_notice(POOL_CONNECTION_POOL * backend, int node_id, char *query)
+{
+ if (pool_config->notice_per_node_statement)
+ ereport(NOTICE,
+ (errmsg("DB node id: %d statement: %s", node_id, query)));
+}
+
/*
* Check kind and produce error message
* All data read in this function is returned to stream.
#log_per_node_statement = off
# Log all statements
# with node and backend informations
+#notice_per_node_statement = off
+ # logs notice message for per node detailed SQL statements
#log_client_messages = off
# Log any client messages
#log_standby_delay = 'if_over_threshold'