Add restriction about set_config.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Wed, 2 Feb 2022 06:46:50 +0000 (15:46 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Wed, 2 Feb 2022 06:46:50 +0000 (15:46 +0900)
doc.ja/src/sgml/restrictions.sgml
doc/src/sgml/restrictions.sgml

index bbcaeb3e818560af6d3f420dadcef45d30097315..ff00f0b7c5cf24131d537b06e0a22c3f6695f882 100644 (file)
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term>set_config</term>
+    <listitem>
+     <para>
+<!--
+       <productname>PostgreSQL</productname>
+       has <function>set_config</function> function which allows to
+       change parameter values within current session
+       like <command>SET</command> command
+       (actually <function>set_config</function> has more feature than
+       SET. See <productname>PostgreSQL</productname> manual for more
+       details).  When <productname>Pgpool-II</productname> is
+       operated
+       with <link linkend="guc-backend-clustering-mode">clustering
+       mode</link> being set to
+       <literal>streaming_replication</literal>, it sends the function
+       only to the primary server. As the function is not sent to the
+       standby servers, the parameter values are different among each
+       servers. To avoid the problem, you can
+       use <command>SET</command> command instead
+       of <function>set_config</function>.
+       Since <command>SET</command> command is sent to all servers
+       used for this session, the issue will not happen.  However, if
+       you use more than 2 <productname>PostgreSQL</productname>
+       servers, you need to
+       disable <xref linkend="guc-statement-level-load-balance"> and
+       use <command>SET</command> command. This is because,
+       if <xref linkend="guc-statement-level-load-balance"> enabled,
+       queries might be sent to the third server in addition to the
+       primary server and the server which is assigned to the load
+       balance node.
+-->
+       <productname>PostgreSQL</productname>には<function>set_config</function>という関数があり、<command>SET</command>コマンドで現在のセッションに対してパラメータの値を変更するのと同じ効果を与えることができます(実際にはSETにない機能もあります。詳細は<productname>PostgreSQL</productname>のマニュアルを見てください)。
+       <productname>Pgpool-II</productname>では、現在の<link linkend="guc-backend-clustering-mode">クラスタリングモード</link>が<literal>streaming_replication</literal>の場合、プライマリサーバにのみこの関数を送信します。
+       スタンバイサーバにはこの関数が送信されないので、それぞれのサーバでパラメータの値が異なることになります。
+       この問題を回避するには、<function>set_config</function>の代わりに<command>SET</command>コマンドを使用してください。
+       <command>SET</command>コマンドは、現在のセッションが使用しているすべてのサーバに送信されるので、この問題は起きません。
+       ただし<productname>PostgreSQL</productname>サーバを3台以上使っているときは、<xref linkend="guc-statement-level-load-balance">をoffにした上で<command>SET</command>コマンドを使用してください。
+       <xref linkend="guc-statement-level-load-balance">がonの場合、現在のセッションが使用しているプライマリサーバ、ロードバランスノードになっているスタンバイサーバに加え、3台目のスタンバイサーバにもクエリを送信する可能性があるからです。
+     </para>
+     <para>
+<!--
+       If you need to use <function>set_config</function>, turn off
+       load balancing for the session (not only
+       for <function>set_config</function>, load balancing should be
+       disabled in the whole session).  You can avoid the issue by
+       sacrificing performance.
+-->
+       どうしても<function>set_config</function>を使わなければならないのであれば、そのセッションでの負荷分散機能をoffにしてください(<function>set_config</function>だけでなく、そのセッションで負荷分散機能を使わないようにする必要があります)。
+       性能は犠牲になりますが、問題は回避できます。
+     </para>
+    </listitem>
+   </varlistentry>
+
   </variablelist>
  </para>
 </sect1>
index 3ce8c04e3b021c91e3b9f94672cca73d4f510eb6..6383d45496e90cf08faf2cf9b79c6a523352e4c4 100644 (file)
     </listitem>
    </varlistentry>
 
+   <varlistentry>
+    <term>set_config</term>
+    <listitem>
+     <para>
+       <productname>PostgreSQL</productname>
+       has <function>set_config</function> function which allows to
+       change parameter values within current session
+       like <command>SET</command> command
+       (actually <function>set_config</function> has more feature than
+       SET. See <productname>PostgreSQL</productname> manual for more
+       details).  When <productname>Pgpool-II</productname> is
+       operated
+       with <link linkend="guc-backend-clustering-mode">clustering
+       mode</link> being set to
+       <literal>streaming_replication</literal>, it sends the function
+       only to the primary server. As the function is not sent to the
+       standby servers, the parameter values are different among each
+       servers. To avoid the problem, you can
+       use <command>SET</command> command instead
+       of <function>set_config</function>.
+       Since <command>SET</command> command is sent to all servers
+       used for this session, the issue will not happen.  However, if
+       you use more than 2 <productname>PostgreSQL</productname>
+       servers, you need to
+       disable <xref linkend="guc-statement-level-load-balance"> and
+       use <command>SET</command> command. This is because,
+       if <xref linkend="guc-statement-level-load-balance"> enabled,
+       queries might be sent to the third server in addition to the
+       primary server and the server which is assigned to the load
+       balance node.
+     </para>
+     <para>
+       If you need to use <function>set_config</function>, turn off
+       load balancing for the session (not only
+       for <function>set_config</function>, load balancing should be
+       disabled in the whole session).  You can avoid the issue by
+       sacrificing performance.
+     </para>
+    </listitem>
+   </varlistentry>
+
   </variablelist>
  </para>
 </sect1>