Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4cf9ef6

Browse files
committed
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
1 parent 6614d38 commit 4cf9ef6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/utils/activity/backend_status.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,9 @@ pgstat_beinit(void)
263263
* Assign the MyBEEntry for an auxiliary process. Since it doesn't
264264
* have a BackendId, the slot is statically allocated based on the
265265
* auxiliary process type (MyAuxProcType). Backends use slots indexed
266-
* in the range from 1 to MaxBackends (inclusive), so we use
267-
* MaxBackends + AuxBackendType + 1 as the index of the slot for an
268-
* auxiliary process.
266+
* in the range from 0 to MaxBackends (exclusive), so we use
267+
* MaxBackends + AuxProcType as the index of the slot for an auxiliary
268+
* process.
269269
*/
270270
MyBEEntry = &BackendStatusArray[MaxBackends + MyAuxProcType];
271271
}

0 commit comments

Comments
 (0)