Skip to content

Commit 2f66e29

Browse files
committed
Correct the formulas for System V IPC parameters SEMMNI and SEMMNS in docs.
In runtime.sgml, the old formulas for calculating the reasonable values of SEMMNI and SEMMNS were incorrect. They have forgotten to count the number of semaphores which both the checkpointer process (introduced in 9.2) and the background worker processes (introduced in 9.3) need. This commit fixes those formulas so that they count the number of semaphores which the checkpointer process and the background worker processes need. Report and patch by Kyotaro Horiguchi. Only the patch for 9.3 was modified by me. Back-patch to 9.2 where the checkpointer process was added and the number of needed semaphores was increased. Author: Kyotaro Horiguchi Reviewed-by: Fujii Masao Backpatch: 9.2 Discussion: http://www.postgresql.org/message-id/20160203.125119.66820697.horiguchi.kyotaro@lab.ntt.co.jp
1 parent ccbb01f commit 2f66e29

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

doc/src/sgml/runtime.sgml

+8-6
Original file line numberDiff line numberDiff line change
@@ -645,13 +645,13 @@ psql: could not connect to server: No such file or directory
645645
<row>
646646
<entry><varname>SEMMNI</></>
647647
<entry>Maximum number of semaphore identifiers (i.e., sets)</>
648-
<entry>at least <literal>ceil((max_connections + autovacuum_max_workers + 4) / 16)</literal></>
648+
<entry>at least <literal>ceil((max_connections + autovacuum_max_workers + max_worker_processes + 5) / 16)</literal></>
649649
</row>
650650

651651
<row>
652652
<entry><varname>SEMMNS</></>
653653
<entry>Maximum number of semaphores system-wide</>
654-
<entry><literal>ceil((max_connections + autovacuum_max_workers + 4) / 16) * 17</literal> plus room for other applications</>
654+
<entry><literal>ceil((max_connections + autovacuum_max_workers + max_worker_processes + 5) / 16) * 17</literal> plus room for other applications</>
655655
</row>
656656

657657
<row>
@@ -699,20 +699,22 @@ psql: could not connect to server: No such file or directory
699699

700700
<para>
701701
<productname>PostgreSQL</> uses one semaphore per allowed connection
702-
(<xref linkend="guc-max-connections">) and allowed autovacuum worker
703-
process (<xref linkend="guc-autovacuum-max-workers">), in sets of 16.
702+
(<xref linkend="guc-max-connections">), allowed autovacuum worker process
703+
(<xref linkend="guc-autovacuum-max-workers">) and allowed background
704+
process (<xref linkend="guc-max-worker-processes">), in sets of 16.
704705
Each such set will
705706
also contain a 17th semaphore which contains a <quote>magic
706707
number</quote>, to detect collision with semaphore sets used by
707708
other applications. The maximum number of semaphores in the system
708709
is set by <varname>SEMMNS</>, which consequently must be at least
709710
as high as <varname>max_connections</> plus
710-
<varname>autovacuum_max_workers</>, plus one extra for each 16
711+
<varname>autovacuum_max_workers</> plus <varname>max_worker_processes</>,
712+
plus one extra for each 16
711713
allowed connections plus workers (see the formula in <xref
712714
linkend="sysvipc-parameters">). The parameter <varname>SEMMNI</>
713715
determines the limit on the number of semaphore sets that can
714716
exist on the system at one time. Hence this parameter must be at
715-
least <literal>ceil((max_connections + autovacuum_max_workers + 4) / 16)</>.
717+
least <literal>ceil((max_connections + autovacuum_max_workers + max_worker_processes + 5) / 16)</>.
716718
Lowering the number
717719
of allowed connections is a temporary workaround for failures,
718720
which are usually confusingly worded <quote>No space

0 commit comments

Comments
 (0)