summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorMichael Paquier2025-12-30 05:03:49 +0000
committerMichael Paquier2025-12-30 05:03:49 +0000
commit9cf746a453c15ffdf652a6d50683bfd82e654950 (patch)
treec0c97db23b8c64efca0edffcc8ed3c860d1fbb5e /src/backend
parent7da9d8f2db655eefba8757a66097bfabd3660a82 (diff)
Change GetMultiXactInfo() to return the next multixact offsetHEADmaster
This routine returned a number of members as a MultiXactOffset, calculated based on the difference between the next-to-be-assigned offset and the oldest offset. However, this number is not actually an offset but a number. This type confusion comes from the original implementation of MultiXactMemberFreezeThreshold(), in 53bb309d2d5a. The number of members is now defined as a uint64, large enough for MultiXactOffset. This change will be used in a follow-up patch. Reviewed-by: Naga Appani <nagnrik@gmail.com> Discussion: https://postgr.es/m/aUyTvZMq2CLgNEB4@paquier.xyz
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/access/transam/multixact.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index 34956a5a663..0d6f594e2a0 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -2461,25 +2461,23 @@ find_multixact_start(MultiXactId multi, MultiXactOffset *result)
*
* Returns information about the current MultiXact state, as of:
* multixacts: Number of MultiXacts (nextMultiXactId - oldestMultiXactId)
- * members: Number of member entries (nextOffset - oldestOffset)
+ * nextOffset: Next-to-be-assigned offset
* oldestMultiXactId: Oldest MultiXact ID still in use
* oldestOffset: Oldest offset still in use
*/
void
-GetMultiXactInfo(uint32 *multixacts, MultiXactOffset *members,
+GetMultiXactInfo(uint32 *multixacts, MultiXactOffset *nextOffset,
MultiXactId *oldestMultiXactId, MultiXactOffset *oldestOffset)
{
- MultiXactOffset nextOffset;
MultiXactId nextMultiXactId;
LWLockAcquire(MultiXactGenLock, LW_SHARED);
- nextOffset = MultiXactState->nextOffset;
+ *nextOffset = MultiXactState->nextOffset;
*oldestMultiXactId = MultiXactState->oldestMultiXactId;
nextMultiXactId = MultiXactState->nextMXact;
*oldestOffset = MultiXactState->oldestOffset;
LWLockRelease(MultiXactGenLock);
- *members = nextOffset - *oldestOffset;
*multixacts = nextMultiXactId - *oldestMultiXactId;
}
@@ -2514,16 +2512,18 @@ GetMultiXactInfo(uint32 *multixacts, MultiXactOffset *members,
int
MultiXactMemberFreezeThreshold(void)
{
- MultiXactOffset members;
uint32 multixacts;
uint32 victim_multixacts;
double fraction;
int result;
MultiXactId oldestMultiXactId;
MultiXactOffset oldestOffset;
+ MultiXactOffset nextOffset;
+ uint64 members;
- /* Read the current offsets and members usage. */
- GetMultiXactInfo(&multixacts, &members, &oldestMultiXactId, &oldestOffset);
+ /* Read the current offsets and multixact usage. */
+ GetMultiXactInfo(&multixacts, &nextOffset, &oldestMultiXactId, &oldestOffset);
+ members = nextOffset - oldestOffset;
/* If member space utilization is low, no special action is required. */
if (members <= MULTIXACT_MEMBER_LOW_THRESHOLD)