This is an automated email from the ASF dual-hosted git repository.

leborchuk pushed a commit to branch REL_2_STABLE
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 28a67f9bea4bbb58147a3a9850835e684c3573c9
Author: Heikki Linnakangas <[email protected]>
AuthorDate: Wed Jan 17 15:44:10 2024 +0200

    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/[email protected]
    Backpatch-through: v14
    (cherry picked from commit 28215a32b5154e11574b6e924519b0fb8be4b041)
---
 src/backend/utils/activity/backend_status.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/backend/utils/activity/backend_status.c 
b/src/backend/utils/activity/backend_status.c
index 2c60349b808..494e9b39c22 100644
--- a/src/backend/utils/activity/backend_status.c
+++ b/src/backend/utils/activity/backend_status.c
@@ -264,9 +264,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];
        }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to