pgpool2.git / summary / log / commit / refs
commit 17352edb15faf64752a22fd4f1491cf3f268cd19
Author: Tatsuo Ishii <ishii@postgresql.org>
Date: Wed Sep 30 01:16:47 2026 +0000
Doc: fix track_table_mutation memory figures and eviction description.
The track table mutation documentation understated the shared memory the
feature requires and described its eviction order incorrectly.
TrackTableMutationEntry is 56 bytes, not the documented 40: it holds two
struct timeval fields (16 bytes each on LP64), two ints, a uint32, an int
and a bool, which pad to 56. With the default track_table_mutation_table_size
of 2048 that is ~112 KB for the entries, plus ~4 KB for the default 1024
hash buckets, so the feature needs ~116 KB rather than ~80 KB. The
4096-table example needs ~228 KB, not ~160 KB. The bucket array was not
accounted for at all before; it is now mentioned explicitly.
The docs also stated that the oldest entries are evicted when the map is
full. table_map_insert() actually scans from bucket zero and evicts the
head of the first non-empty bucket, so the eviction order follows the hash
bucket layout and not the write time. Describe what the code does, and
note that expired entries are reclaimed opportunistically, so a live entry
is only evicted when more than track_table_mutation_table_size tables are
written inside one TTL window.
The Japanese document patch by Tatsuo Ishii.
Author: Nadav Shatz <nadav@tailorbrands.com>
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>
Discussion: https://www.postgresql.org/message-id/CACeKOO1v6%2BKiK-qns_37zCz7YYxJ6Zi_xKaLAuQcjkYQcjQu2Q%40mail.gmail.com
Backpatch-through: master only
doc.ja/src/sgml/loadbalance.sgml | 17 ++++++++++-------
doc/src/sgml/loadbalance.sgml | 23 +++++++++++++++--------
2 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/doc.ja/src/sgml/loadbalance.sgml b/doc.ja/src/sgml/loadbalance.sgml
index 3a0703632..e365c54fa 100644
--- a/doc.ja/src/sgml/loadbalance.sgml
+++ b/doc.ja/src/sgml/loadbalance.sgml
@@ -1686,9 +1686,11 @@ dml_adaptive_object_relationship_list = 'table_1:table_2'
<warning>
<para>
<literal>dml_adaptive_global</literal>を有効にすると、共有メモリがより多く使用されます。
- デフォルトの設定では、この機能によっておおよそ80 KBの共有メモリが使用されます。
- <literal>track_table_mutation_table_size * 40 bytes</literal>
- (default: 2048 * 40 = ~80 KB).
+ デフォルトの設定では、この機能によっておおよそ116KBの共有メモリがテーブルの追跡に使用されます。
+ <literal>track_table_mutation_table_size * 56 bytes</literal>
+ (default: 2048 * 56 = ~112 KB)が各エントリで費やされ、更に
+ <literal>track_table_mutation_table_buckets * 4 bytes</literal>
+ (default: 1024 * 4 = ~4 KB) がハッシュバケット配列に費やされます。
</para>
</warning>
@@ -1791,12 +1793,13 @@ dml_adaptive_object_relationship_list = 'table_1:table_2'
<listitem>
<para>
テーブル変更追跡機能で同時に追跡できるテーブル数の最大値です。
- いっぱいになると、単純な立ち退き戦略により、最も古いエントリが立ち退きます。
+ いっぱいになると、最初の空ではないハッシュバケットが削除されて、新しいハッシュバケットが追加される余地を作ります。
+ これは最旧エントリではないことに注意してください。立ち退きの順番は、バケットのレイアウトに従います。期限切れのエントリはマップファイルにしたがい、臨機応変に再利用されます。これにより、<varname>track_table_mutation_table_size</varname>の以上のテーブルが一つのTTLウィンドウの間に書かれたときにだけ、生きているエントリの立ち退きが起こります。
</para>
<para>
有効な範囲は128-131072です。
デフォルトは<literal>2048</literal>です。
- エントリごとに約40バイトを消費します。
+ エントリごとに約56バイトを消費します。
このパラメータはサーバの起動時にのみ設定可能です。
</para>
</listitem>
@@ -1827,8 +1830,8 @@ track_table_mutation_table_size = 4096
</programlisting>
</para>
<para>
- 上記の設定で必要とする共有メモリはテーブルマップのために約160 KBです。
- デフォルトの設定(テーブル数2048)では約80 KBとなります。
+ 上記の設定で必要とする共有メモリはテーブルマップのために約228 KBです。
+ デフォルトの設定(テーブル数2048)では約116 KBとなります。
</para>
</sect3>
diff --git a/doc/src/sgml/loadbalance.sgml b/doc/src/sgml/loadbalance.sgml
index 0c57e37f6..f815d5b0f 100644
--- a/doc/src/sgml/loadbalance.sgml
+++ b/doc/src/sgml/loadbalance.sgml
@@ -1250,10 +1250,12 @@ dml_adaptive_object_relationship_list = 'table_1:table_2'
<warning>
<para>
Enabling <literal>dml_adaptive_global</literal> increases shared memory
- consumption. With default settings, the feature requires approximately 80
+ consumption. With default settings, the feature requires approximately 116
KB of shared memory for table tracking:
- <literal>track_table_mutation_table_size * 40 bytes</literal>
- (default: 2048 * 40 = ~80 KB).
+ <literal>track_table_mutation_table_size * 56 bytes</literal>
+ (default: 2048 * 56 = ~112 KB) for the entries, plus
+ <literal>track_table_mutation_table_buckets * 4 bytes</literal>
+ (default: 1024 * 4 = ~4 KB) for the hash bucket array.
</para>
</warning>
@@ -1362,12 +1364,17 @@ dml_adaptive_object_relationship_list = 'table_1:table_2'
<listitem>
<para>
Maximum number of tables that can be tracked simultaneously in the track
- table mutation. When full, oldest entries are evicted using a simple
- eviction strategy.
+ table mutation. When full, an entry is evicted from the first non-empty
+ hash bucket to make room for the new one. Note that this is not the
+ least recently written entry: the eviction order follows the hash bucket
+ layout, not the write time. Expired entries are also reclaimed
+ opportunistically as the map fills, so eviction of a live entry only
+ happens when more than <varname>track_table_mutation_table_size</varname>
+ tables are written within one TTL window.
</para>
<para>
Valid range: 128-131072. Default is <literal>2048</literal>. Memory
- usage: approximately 40 bytes per entry. This parameter can only be set
+ usage: approximately 56 bytes per entry. This parameter can only be set
at server start.
</para>
</listitem>
@@ -1398,9 +1405,9 @@ replication_delay_source_timeout = 10
track_table_mutation_table_size = 4096
</programlisting>
<para>
- Shared memory required for above configuration: approximately 160 KB for
+ Shared memory required for above configuration: approximately 228 KB for
the table map. Default configuration (2048 tables) requires approximately
- 80 KB.
+ 116 KB.
</para>
</sect3>
[parent: 3fb1d89cea0a]