summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2024-01-17 15:44:10 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2024-01-17 15:46:05 +0200
commit28215a32b5154e11574b6e924519b0fb8be4b041 (patch)
treeed34af0f4e9b2a29c945189b3edff48ffdc9d2d5 /src
parentd8f6ab5f66a3fcce61694308172ffd6c9e04d6b2 (diff)
Fix incorrect comment on how BackendStatusArray is indexed
The comment was copy-pasted from the call to ProcSignalInit() in AuxiliaryProcessMain(), which uses a similar scheme of having reserved slots for aux processes after MaxBackends slots for backends. However, ProcSignalInit() indexing starts from 1, whereas BackendStatusArray starts from 0. The code is correct, but the comment was wrong. Discussion: https://www.postgresql.org/message-id/f3ecd4cb-85ee-4e54-8278-5fabfb3a4ed0@iki.fi Backpatch-through: v14
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/activity/backend_status.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/utils/activity/backend_status.c b/src/backend/utils/activity/backend_status.c
index 6917ef4c4ba..76b6584d694 100644
--- a/src/backend/utils/activity/backend_status.c
+++ b/src/backend/utils/activity/backend_status.c
@@ -263,9 +263,9 @@ pgstat_beinit(void)
* Assign the MyBEEntry for an auxiliary process. Since it doesn't
* have a BackendId, the slot is statically allocated based on the
* auxiliary process type (MyAuxProcType). Backends use slots indexed
- * in the range from 1 to MaxBackends (inclusive), so we use
- * MaxBackends + AuxBackendType + 1 as the index of the slot for an
- * auxiliary process.
+ * in the range from 0 to MaxBackends (exclusive), so we use
+ * MaxBackends + AuxProcType as the index of the slot for an auxiliary
+ * process.
*/
MyBEEntry = &BackendStatusArray[MaxBackends + MyAuxProcType];
}