postgres.git / summary / log / commit / refs

commit    7d42e2367c6bdd5538fc914cd6858133bfb63f79
Author:   Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date:     Mon Dec 15 09:47:04 2025 +0000
First released in: 14.21, 15.16, 16.12, 17.8, 18.2

    Clarify comment on multixid offset wraparound check
    
    Coverity complained that offset cannot be 0 here because there's an
    explicit check for "offset == 0" earlier in the function, but it
    didn't see the possibility that offset could've wrapped around to 0.
    The code is correct, but clarify the comment about it.
    
    The same code exists in backbranches in the server
    GetMultiXactIdMembers() function and in 'master' in the pg_upgrade
    GetOldMultiXactIdSingleMember function. In backbranches Coverity
    didn't complain about it because the check was merely an assertion,
    but change the comment in all supported branches for consistency.
    
    Per Tom Lane's suggestion.
    
    Discussion: https://www.postgresql.org/message-id/1827755.1765752936@sss.pgh.pa.us


src/backend/access/transam/multixact.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c index a0ffa513e94..8385abb0a4d 100644 --- a/src/backend/access/transam/multixact.c +++ b/src/backend/access/transam/multixact.c @@ -1504,7 +1504,10 @@ GetMultiXactIdMembers(MultiXactId multi, MultiXactMember **members, if (!TransactionIdIsValid(*xactptr)) { - /* Corner case 2: we must be looking at unused slot zero */ + /* + * Corner case 2: offset must have wrapped around to unused slot + * zero. + */ Assert(offset == 0); continue; } [parent: 5a4dc4aabd03]