summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas2022-03-29 13:24:24 +0000
committerRobert Haas2022-03-29 13:24:24 +0000
commitedea649afbcedd431802a5255cd153538e43ee1d (patch)
treeedcaf9f189131feb5564f52d2416f281393ee6e9
parent3785d8e98b741749d09f1cfe119ec04961ed07b2 (diff)
Explain why the startup process can't cause a shortage of sinval slots.
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
-rw-r--r--src/backend/storage/ipc/sinvaladt.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/storage/ipc/sinvaladt.c b/src/backend/storage/ipc/sinvaladt.c
index 68e7160b30..2dec668bbc 100644
--- a/src/backend/storage/ipc/sinvaladt.c
+++ b/src/backend/storage/ipc/sinvaladt.c
@@ -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;