Skip to content

Commit c425113

Browse files
committed
Clamp result of MultiXactMemberFreezeThreshold
The purpose of the function is to reduce the effective autovacuum_multixact_freeze_max_age if the multixact members SLRU is approaching wraparound, to make multixid freezing more aggressive. The returned value should therefore never be greater than plain autovacuum_multixact_freeze_max_age. Reviewed-by: Robert Haas Discussion: https://www.postgresql.org/message-id/[email protected] Backpatch-through: 12, all supported versions
1 parent f839087 commit c425113

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/backend/access/transam/multixact.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -2932,6 +2932,7 @@ MultiXactMemberFreezeThreshold(void)
29322932
uint32 multixacts;
29332933
uint32 victim_multixacts;
29342934
double fraction;
2935+
int result;
29352936

29362937
/* If we can't determine member space utilization, assume the worst. */
29372938
if (!ReadMultiXactCounts(&multixacts, &members))
@@ -2953,7 +2954,13 @@ MultiXactMemberFreezeThreshold(void)
29532954
/* fraction could be > 1.0, but lowest possible freeze age is zero */
29542955
if (victim_multixacts > multixacts)
29552956
return 0;
2956-
return multixacts - victim_multixacts;
2957+
result = multixacts - victim_multixacts;
2958+
2959+
/*
2960+
* Clamp to autovacuum_multixact_freeze_max_age, so that we never make
2961+
* autovacuum less aggressive than it would otherwise be.
2962+
*/
2963+
return Min(result, autovacuum_multixact_freeze_max_age);
29572964
}
29582965

29592966
typedef struct mxtruncinfo

0 commit comments

Comments
 (0)