1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-19 17:02:53 +03:00

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
This commit is contained in:
Heikki Linnakangas
2025-12-15 11:47:04 +02:00
parent 0bab0c3b74
commit cd1a887fe9

View File

@@ -1602,7 +1602,10 @@ GetMultiXactIdMembers(MultiXactId multi, MultiXactMember **members,
if (!TransactionIdIsValid(*xactptr)) 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); Assert(offset == 0);
continue; continue;
} }