mirror of
https://github.com/postgres/postgres.git
synced 2026-07-15 20:52:53 -04:00
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 <nagnrik@gmail.com> Co-authored-by: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/aUyTvZMq2CLgNEB4@paquier.xyz
This commit is contained in:
parent
9cf746a453
commit
0e3ad4b96a
1 changed files with 10 additions and 0 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Reference in a new issue