Explain why the startup process can't cause a shortage of sinval slots.
authorRobert Haas <rhaas@postgresql.org>
Tue, 29 Mar 2022 13:24:24 +0000 (09:24 -0400)
committerRobert Haas <rhaas@postgresql.org>
Tue, 29 Mar 2022 13:24:24 +0000 (09:24 -0400)
Bharath Rupireddy, reviewed by Fujii Masao and Yura Sokolov.
Lightly edited by me.

Discussion: http://postgr.es/m/CALj2ACU=3_frMkDp9UUeuZoAMjaK1y0Z_q5RFNbGvwi8NM==AA@mail.gmail.com

src/backend/storage/ipc/sinvaladt.c

index 68e7160b30e2073bfd865b55c0190972ca389ee4..2dec668bbcd04b82a62908f24747105e49a8e84b 100644 (file)
@@ -205,6 +205,14 @@ SInvalShmemSize(void)
    Size        size;
 
    size = offsetof(SISeg, procState);
+
+   /*
+    * In Hot Standby mode, the startup process requests a procState array
+    * slot using InitRecoveryTransactionEnvironment(). Even though MaxBackends
+    * doesn't account for the startup process, it is guaranteed to get a
+    * free slot. This is because the autovacuum launcher and worker processes,
+    * which are included in MaxBackends, are not started in Hot Standby mode.
+    */
    size = add_size(size, mul_size(sizeof(ProcState), GetMaxBackends()));
 
    return size;