aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2024-06-13 19:01:30 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2024-06-13 19:02:51 +0300
commit7768ac1c17f0ec7883825e8768ab480caa7842ec (patch)
tree14f1fa907c6c543021922822ec043c3fd7055ee2 /src
parentc38518fa978075d08d64a34e1b4504da13a81e02 (diff)
downloadpostgresql-7768ac1c17f0ec7883825e8768ab480caa7842ec.tar.gz
postgresql-7768ac1c17f0ec7883825e8768ab480caa7842ec.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/multixact.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index b8b1773d16a..136065125ea 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -2832,6 +2832,7 @@ MultiXactMemberFreezeThreshold(void)
uint32 multixacts;
uint32 victim_multixacts;
double fraction;
+ int result;
/* If we can't determine member space utilization, assume the worst. */
if (!ReadMultiXactCounts(&multixacts, &members))
@@ -2853,7 +2854,13 @@ MultiXactMemberFreezeThreshold(void)
/* fraction could be > 1.0, but lowest possible freeze age is zero */
if (victim_multixacts > multixacts)
return 0;
- return multixacts - victim_multixacts;
+ result = multixacts - victim_multixacts;
+
+ /*
+ * Clamp to autovacuum_multixact_freeze_max_age, so that we never make
+ * autovacuum less aggressive than it would otherwise be.
+ */
+ return Min(result, autovacuum_multixact_freeze_max_age);
}
typedef struct mxtruncinfo