mirror of
https://github.com/postgres/postgres.git
synced 2026-10-28 02:33:10 +03:00
Fix scaling of autovacuum freeze scores.
Sufficiently large settings of the *_freeze_score_weight parameters
can lower the scaling thresholds below the *_freeze_max_age
settings. This can lead the scoring code to raise a value < 1.0 to
a power > 1.0, thus lowering the score, which is the opposite of
what is intended. To fix, only exponentiate the scores when doing
so won't lower their values.
Oversight in commit d7965d65fc.
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Greg Burd <greg@burd.me>
Discussion: https://postgr.es/m/apWcbq91BAfhmsKU%40nathan
Backpatch-through: 19
This commit is contained in:
@@ -3210,9 +3210,10 @@ relation_needs_vacanalyze(Oid relid,
|
||||
if (autovacuum_multixact_freeze_score_weight > 1.0)
|
||||
effective_mxid_failsafe_age /= autovacuum_multixact_freeze_score_weight;
|
||||
|
||||
if (xid_age >= effective_xid_failsafe_age)
|
||||
/* We must be careful to avoid lowering the score. */
|
||||
if (xid_age >= effective_xid_failsafe_age && scores->xid > 1.0)
|
||||
scores->xid = pow(scores->xid, Max(1.0, (double) xid_age / 100000000));
|
||||
if (mxid_age >= effective_mxid_failsafe_age)
|
||||
if (mxid_age >= effective_mxid_failsafe_age && scores->mxid > 1.0)
|
||||
scores->mxid = pow(scores->mxid, Max(1.0, (double) mxid_age / 100000000));
|
||||
|
||||
scores->xid *= autovacuum_freeze_score_weight;
|
||||
|
||||
Reference in New Issue
Block a user