From 0e3ad4b96aedee57fc2694e28486fe0ceca8110a Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Tue, 30 Dec 2025 14:13:40 +0900 Subject: [PATCH] Add MultiXactOffsetStorageSize() to multixact_internal.h This function calculates in bytes the storage taken between two multixact offsets. This will be used in an upcoming patch, introduced separately here as this piece can be useful on its own. Author: Naga Appani Co-authored-by: Michael Paquier Discussion: https://postgr.es/m/aUyTvZMq2CLgNEB4@paquier.xyz --- src/include/access/multixact_internal.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/include/access/multixact_internal.h b/src/include/access/multixact_internal.h index f2d6539e8a6..afe1f037610 100644 --- a/src/include/access/multixact_internal.h +++ b/src/include/access/multixact_internal.h @@ -121,4 +121,14 @@ MXOffsetToMemberOffset(MultiXactOffset offset) member_in_group * sizeof(TransactionId); } +/* Storage space consumed by a range of offsets, in bytes */ +static inline uint64 +MultiXactOffsetStorageSize(MultiXactOffset new_offset, + MultiXactOffset old_offset) +{ + Assert(new_offset >= old_offset); + return (uint64) ((new_offset - old_offset) / MULTIXACT_MEMBERS_PER_MEMBERGROUP) * + MULTIXACT_MEMBERGROUP_SIZE; +} + #endif /* MULTIXACT_INTERNAL_H */