Skip to content

Commit d881f6f

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/85fb354c-f89f-4d47-b3a2-3cbd461c90a3@iki.fi Backpatch-through: 12, all supported versions
1 parent 0e51485 commit d881f6f

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
@@ -2832,6 +2832,7 @@ MultiXactMemberFreezeThreshold(void)
28322832
uint32 multixacts;
28332833
uint32 victim_multixacts;
28342834
double fraction;
2835+
int result;
28352836

28362837
/* If we can't determine member space utilization, assume the worst. */
28372838
if (!ReadMultiXactCounts(&multixacts, &members))
@@ -2853,7 +2854,13 @@ MultiXactMemberFreezeThreshold(void)
28532854
/* fraction could be > 1.0, but lowest possible freeze age is zero */
28542855
if (victim_multixacts > multixacts)
28552856
return 0;
2856-
return multixacts - victim_multixacts;
2857+
result = multixacts - victim_multixacts;
2858+
2859+
/*
2860+
* Clamp to autovacuum_multixact_freeze_max_age, so that we never make
2861+
* autovacuum less aggressive than it would otherwise be.
2862+
*/
2863+
return Min(result, autovacuum_multixact_freeze_max_age);
28572864
}
28582865

28592866
typedef struct mxtruncinfo

0 commit comments

Comments
 (0)